One of New Zealand’s most senior naval officers is accused of hiding a secret camera in the toilets of the New Zealand embassy in Washington, in an attempt to obtain intimate footage of people using the bathroom.

Alfred Keating, 58, was a commodore in the New Zealand navy and was one of the country’s most senior naval officers before he resigned last month.

Keating was serving as a defence attache embassy in Washington in July 2017. On 27 July a small covert camera was discovered in a unisex bathroom in the embassy when it fell out of a hiding spot in a heating duct.

It had been positioned to capture images of anyone using the toilet. The embassy toilet was generally used by approximately 60 embassy staff.

New Zealand police travelled to Washington to investigate, and brought the recording device back to be forensically examined.

The investigation revealed the device had been in place for some months, as the homemade platform it was mounted on was covered in a thick layer of dust.

On the day it was discovered the camera had been activated at 9am and had captured 19 images over a five-hour period of people using the bathroom.

A search warrant of Keating’s home in New Zealand led to him being charged with attempting to obtain intimate visual recordings.

The prosecution alleges that Keating’s computer contained software to operate the camera, and also that his DNA matched that found on the SD card inside the camera. He has pleaded not guilty to the charges.

Keating joined the navy in 1976 and has studied engineering in the UK; worked as a team leader on the Australian and New Zealand Anzac frigate project; served as New Zealand’s assistant naval attache and senior technical officer in the US; and worked as the assistant chief of navy in Wellington.