Gay pornography found on the computer of a US Navy doctor has been accepted as evidence in his trial on charges that he made secret video recordings of Naval Academy midshipmen having sex in his home, a military judge ruled.

Even if Commander Kevin Ronan is found innocent at the conclusion of his trial this month, the emergence of such evidence often triggers a military investigation into a service member’s sexual orientation, which could mean the end of his military career.

Ronan is charged with seven counts of conduct unbecoming an officer, three counts of illegal wiretapping and one count of obstruction of justice. Prosecutors say the pornography establishes a motive for the alleged surreptitious taping of the midshipmen.

Ronan allegedly used a video camera hidden in an air purifier in his home to tape academy midshipmen he hosted at his house last year.

The Navy began its investigation in January after two men, one a midshipman the other a former student at the Academy, allegedly found the recordings in Ronan’s home and turned them over to authorities.

Ronan recorded midshipmen either with partners or alone in his spare bedrooms, edited them down to the sexually explicit content and transferred them to DVDs, Navy prosecutor Lt Justin Henderson said.

Hundreds of gay pornographic images were allegedly found on Ronan’s home computer.

“Dr Ronan violated the trust of his midshipman sponsorees,” Henderson told the jury of six Navy officers hearing the case at the Washington Navy Yard, according to the Irish Examiner.

Navy investigators found a purifier with a camera inside in the attic of Ronan’s Annapolis home. The system is commonly known as a “nanny cam” for secretly monitoring nannies.

Ronan hosted roughly a dozen students under the sponsoring programme where the midshipmen spend weekends off campus at private homes to relax.

His lawyer, William Ferris, said Ronan did not make the videotapes and that he bought the air purifier with the camera only to check on whether the midshipman he sponsored were having parties while he was away.

The tapes could have been the result of an attempt by one of the two to extract money from Ronan, Ferris said.

One of the men was expelled from the academy in January, and faced the prospect of having to repay thousands of dollars to the US government for his education. He had already asked Ronan for money and had been refused.

“This was a plan to extort money from Mr Ronan that went awry,” Ferris told the court.

The lawyer also suggested that midshipmen, who had access to Ronan’s home computer, may have been responsible for the pornography found on his hard drive.

The military judge hearing the case ruled earlier this month that prosecutors could use the pornography in their case, described by Henderson as images of “athletic young men” and stills from pornographic videos.

Ferris said the photos were not relevant to the case, which is expected to last two weeks.