Alfred (Fred) Keating, formerly one of the Royal New Zealand Navy's top officers, is on trial in the Auckland District Court. Photo: NZME

New Zealand's former top military attache to the United States is on trial accused of planting a hidden camera inside the toilets of the Kiwi embassy in Washington DC.

Alfred (Fred) Keating, who was one of the Royal New Zealand Navy's highest-ranking officers, stood today in the dock at the Auckland District Court before a jury.

The Herald first reported the allegations against Keating last March.

The former commodore is charged with attempting to make an intimate visual recording of another person at the diplomatic building between July 26 and July 28, 2017.

Keating denies the allegations.

The 59-year-old was serving as the senior defence attache in Washington in 2017.

On July 27 of that year, a hidden camera was found in a unisex bathroom on level three of the embassy, where Keating was stationed.

It is alleged Keating, the former commanding officer of the Devonport Naval Base, planted the small covert camera.

Crown prosecutor Henry Steele held up the camera for the jury and court to see as he made his opening address this morning.

"We're all here because on the 27th of July 2017 this camera was hidden in a unisex bathroom in the New Zealand embassy in Washington DC," he said.

Keating, Steele alleged, had placed the camera to covertly film his colleagues at the embassy using the toilet.

"This was not an act of espionage," he said.

The story started with a driver working at the embassy, Steele continued.

Upon entering the toilets, the driver noticed a small black box on the floor near a radiator.

Assuming somebody had simply forgotten the device in the bathroom he placed it on top of the radiator.

Steele said the driver was oblivious to what he had found and unaware that the camera was also recording his actions.

The next person to enter the bathroom was Stephen Warren.

When Warren found the device he was "extremely concerned", Steele said, and after inspecting what he initially thought was a hard drive he noticed a tiny camera lens and a memory drive.

Alfred Keating was a commodore and one of the navy's highest-ranking officers. Photo: Supplied

Suspicions and concerns were then raised with security at the embassy and increased when an inscription on the camera read "BrickHouse Security", the camera's brand name which is designed to be hidden.

A small homemade platform was also found taped underneath the radiator.

Steele said the camera was placed in a secure diplomatic bag and sent back to New Zealand.

When it arrived in early August 2017 it was given priority by police, however, forensic examinations found no fingerprints on the camera or on the memory card.

But, Steele added, male DNA was found on the SD card.

More than 700 deleted files and over 20 existing files were also found on the card, all made on July 27, Steele said.

The first video file began just after 9am on that day and showed a blue latex gloved hand around the motion activated camera, the court heard.

The video lasted just short of a minute and showed the camera being placed on the wall near the radiator.

At around the same time a man was seen on the embassy's CCTV entering the bathroom.

He was wearing dark trousers and a white shirt and also wearing a black Fitbit watch, Steele said.

The prosecutor said investigators began to suspect Keating was the man who had entered the bathroom after examining the embassy's swipe card records.

When Keating returned to New Zealand in November 2017 a search of his home was carried out and police seized his laptop and Fitbit watch.

Search records on the laptop showed searches for and access to the website for BrickHouse Security, a New York City-based company which sells security systems, including video cameras and hidden cameras.

Other laptop searches showed access to a webpage explaining how to "set up" the camera and what operational modes were available, Steele added.

He said there was "extremely strong scientific support" that the male DNA found on the memory card originated from Keating.

The former top naval officer enjoyed diplomatic immunity while he was stationed in Washington which meant New Zealand retained criminal jurisdiction over any offence committed in the US, Steele told the jury.

Keating's lawyer, Ron Mansfield, also made a short opening statement.

He compared the Crown's case against his client to a racy celebrity magazine which lures people in with a salacious title and photograph but ultimately leaves the reader disappointed.

"They brag to you about the strength of the case," Mansfield said of Steele's opening statement.

"This is a circumstantial case and we say a weak one," he continued.

"The evidence doesn't tell you who did it and it certainly doesn't tell you it was Mr Keating."

Keating pleaded not guilty last March and two days later resigned from his post in the New Zealand Defence Force (NZDF).

The military leader from Northland had a more than 40-year career, and was the face of diplomacy, negotiating and strategy for the NZDF to the US.

He served as New Zealand's naval attache and senior technical officer for the navy to the US from July 2003 until December 2006, and was also previously the Assistant Chief of Navy at NZDF headquarters in Wellington.

Keating's trial is due to last about two weeks.