Correction: An earlier version of this article incorrectly identified Sterling T. Gill, a Navy official, as a target of the probe. Court documents filed by prosecutors state that she has only been placed on administrative leave by the Navy. This version has been corrected.

An intensifying criminal investigation of an alleged contracting scheme involving a top-secret Navy project has resulted in the forced resignation of the service’s second-ranking civilian leader, according to officials and court documents.

Robert C. Martinage, the acting undersecretary of the Navy, stepped down after his boss, Navy Secretary Ray Mabus, asked for his resignation “following a loss of confidence in [his] abilities to effectively perform his duties,” according to a statement the Navy released Wednesday.

Navy officials said Martinage was pressured to quit after investigators looking into his role in the top-secret program discovered that he was having an affair.

Federal prosecutors testified last week in U.S. District Court in Alexandria that Martinage is not a criminal target of their inquiry. But they said one of his subordinates has told them that Martinage gave approval for a mysterious operation to acquire a large batch of firearm silencers intended for SEAL Team 6, the elite commando unit that killed Osama bin Laden.

In that case, three senior Navy intelligence officials who reported to Martinage are under investigation for an alleged contracting scheme that charged the military $1.6 million for homemade silencers that cost only $8,000 to manufacture, court records show.

The untraceable silencers were purchased from a hot-rod auto mechanic who is a brother of one of the Navy intelligence officials under scrutiny. The mechanic, Mark S. Landersman of Temecula, Calif., has been charged with conspiracy to commit wire fraud and to transport unregistered firearms. His attorneys have denied the charges.

Prosecutors said in court last week that the silencers were acquired for a “special access program,” or a highly secretive military operation. One document filed in the case says the silencers were needed to support “the UPSTAIRS program,” but does not give details.

Many aspects of the investigation have been kept under seal or described in closed court sessions. But some details emerged Friday in a rare hearing that was kept open to the public.

In that session, prosecutors said that Lee M. Hall, one of the three Navy intelligence officials under investigation, recently told them that Martinage had given oral approval for the purchase of the silencers.

Prosecutors said they have interviewed Martinage but did not reveal his version of events. Martinage is not a target of the criminal investigation, said Morris R. Parker Jr., an assistant U.S. attorney and the lead prosecutor in the case.

Martinage, who has a background in special operations and intelligence, had been serving as acting undersecretary of the Navy since April. He also held the title of deputy undersecretary of the Navy for plans, policy, oversight and integration. Martinage did not respond to a phone message seeking comment.

Hall is one of three Navy intelligence officials who have been described in court records as unindicted co-conspirators in the case. His attorney, Danny Onorato, declined to comment.

A second subject of the investigation is David W. Landersman, the senior director for intelligence in the Navy’s directorate for plans, policy, oversight and integration intelligence. A retired Marine colonel, Landersman is the brother of the auto mechanic. His attorney has said he engaged in no wrongdoing.

Court documents filed by prosecutors state that Hall, Landersman and another official who works in the same office, Sterling T. Gill, have been on administrative leave from their Navy jobs for the past 11 months. They have not been charged.

The judge in the case, Leonie M. Brinkema, has questioned the merits of the government’s evidence against Mark Landersman, the auto mechanic, while suggesting that the real focus of the investigation is Navy officials.

On Friday, she cited evidence supplied by Mark Landersman’s attorneys that his $1.6 million price for the silencers was far lower than a quote the Navy received from another manufacturer.

“The case just gets murkier and murkier,” Brinkema said. “Maybe there is a problem there with Mr. Hall or some other people in the government, but the degree to which Mark Landersman is guilty of fraud becomes, I think, much more problematic.”

The silencer investigation is one of two unfolding Navy scandals involving alleged contracting fraud and illicit sex.

In the other case, the Justice Department has arrested two Navy commanders on charges of giving sensitive information to a major Singapore-based defense contractor in exchange for prostitutes, cash bribes and luxury travel. A senior Naval Criminal Investigative Service agent arrested in the same case pleaded guilty to similar charges last month.

In addition, two captains have been suspended or reassigned by the Navy, and two admirals who work in Navy intelligence have had their access to classified materials suspended while investigators scrutinize their possible connections to the Singapore contractor, Glenn Defense Marine Asia.