Officials say a civilian employed by Australian police has been fatally shot outside the state police headquarters in western Sydney and his assailant was then killed.

New South Wales Police Commissioner Andrew Scipione said the victim was shot at close range with a handgun as he left work on Friday. He said officers returned fire and killed the gunman.

The assailant's identity and motive have not been determined.

The civilian was an information technology specialist for the police.

Police said there was nothing to suggest the shooting was terror-related but refused to rule anything out as the investigation continued.

Witnesses reported seeing an armed man in a black gown pacing and yelling outside the police headquarters shortly before a series of shots were heard.