Image copyright iStock Image caption File photo of a webcam being installed

A former top naval officer from New Zealand has been accused of hiding a secret camera in the toilet of the country's embassy in Washington.

Ex-Commodore Alfred Keating was serving as the embassy's senior defence attaché when the camera was found last July.

He has been charged with attempting to make an intimate visual recording and faces a maximum of 18 months in prison if convicted.

Mr Keating has pleaded not guilty to the charges.

New Zealand's High Court dismissed an appeal by Mr Keating to have his name suppressed, with the ex-officer saying his family would face "extreme hardship" if his identity was revealed.

The camera was discovered when it fell onto the floor from inside a heating duct of a unisex bathroom.

"It had been purposely mounted at a height and direction that captured recordings from people who arrived and used the toilet," said Judge Grant Powell, according to court documents seen by AFP.

The camera had a thick layer of dust in its mounting, indicating that it had been in place for months.

The toilet in which the camera was placed was used by approximately 60 people who worked at the embassy.

You might also be interested in:

Police hunt man who took dolphin off beach

'Mystery pooper' suspect is schools chief

Busiest international air route revealed

DNA match

New Zealand police travelled to Washington to investigate and brought the camera back to be forensically examined.

Mr Keating's home in New Zealand was searched, with prosecutors saying that his computer contained software used to operate the camera.

His DNA samples also matched those found on the memory card in the hidden camera.

Mr Keating was New Zealand's most senior military officer stationed in the US at the time.

The Defence Force told news outlet Newshub that Mr Keating was "no longer a member of the NZDF".