Image copyright Getty Images Image caption Spycams can be as small as a memory card, meaning they are very difficult to spot

New Zealand's former top military official in the US is on trial for secretly filming people in the toilet of the country's embassy in Washington.

Alfred Keating is accused of hiding a camera in a heating duct, which was found when it fell onto the floor.

Mr Keating's DNA matched that found on the SD card in the camera, which appeared to have been in place for many months.

The former commodore has pleaded not guilty.

Formerly in the Royal New Zealand Navy, Mr Keating was the highest ranking official at New Zealand's US embassy when the camera was discovered in a unisex bathroom in 2017.

Because he was a foreign official, New Zealand is responsible for Mr Keating's trial, despite the alleged offence taking place in the US.

He is facing a charge of attempting to make an intimate visual recording of another person at Auckland District Court.

The court heard that an embassy worker found the camera on the floor after it had tumbled from the radiator.

At first, the man thought it was a memory drive, but then noticed a tiny camera lens and the brand of the camera, BrickHouse Security.

Investigations of Mr Keating's laptop showed he had accessed the BrickHouse security website, a company which sells hidden video cameras.

A homemade mount was also found taped under the radiator, which was covered in a layer of dust, suggesting the camera had been in place for several months.

The camera was sent back to New Zealand for investigation by police, who found over 700 deleted files and 20 existing files on the memory card.

Image copyright Getty Images Image caption About 60 people worked in the embassy at the time the hidden camera was discovered

They found 19 images of people using the bathroom in a period of five hours.

The court heard that the first video file showed a man wearing blue latex gloves installing the camera. Security camera images from that day pointed to the man being Mr Keating.

When Mr Keating first appeared in court last year, he requested to have his name suppressed as revealing his identity would cause his family "extreme hardship". This was dismissed.

If convicted, he faces a maximum prison sentence of 18 months.