WASHINGTON — Two C.I.A. officers recounted on Tuesday a predawn militant attack on their secret base in Benghazi, Libya, in 2012, detailing the devastating mortar fire that killed two operatives and badly wounded two other Americans after the agency had dispatched a team in a desperate attempt to find the American ambassador.

Using fake names and disguised in wigs and mustaches, the operatives testified in United States District Court in Washington about how they had flown from Tripoli, the Libyan capital, to Benghazi with reinforcements to find Ambassador J. Christopher Stevens, who had disappeared in an attack on the diplomatic compound there the night of Sept. 11, 2012. He later died from his injuries.

As the two men told the jury their story, Ahmed Abu Khattala, the Libyan man accused of helping to orchestrate the attacks on the American Consulate and the C.I.A. base in Benghazi, listened intently to the testimony while occasionally taking notes. Reporters were prohibited from entering the courtroom, and images of the C.I.A. officers were blacked out on video streamed into a room for journalists.

Mr. Abu Khattala, who faces a potential sentence of life in prison if convicted, was captured in June 2014 by military commandos and the F.B.I. This is the second week of his trial, one that has already offered dramatic accounts of militants storming the diplomatic compound in attacks that left the ambassador and Sean Smith, another State Department employee, dead.