Prosecutors are expected to portray Mr. Khatalla as a ringleader of a local militia of Islamic extremists who was angry about the American presence in Benghazi and played a leading role in directing the attacks. Ambassador J. Christopher Stevens was killed, as were three other Americans: Sean Smith, a State Department information officer, and two C.I.A. operatives, Glen Doherty and Tyrone Woods. Mr. Stevens, who died of smoke inhalation, was the first American ambassador killed in an attack since 1979.

During the attacks, militants wielding machine guns and rocket-propelled grenades breached the walls and set fire to the consulate, then used mortars in an attack on the C.I.A. base about a mile away. Later, Mr. Khatalla gave interviews to Western journalists, acknowledging that he was at the consulate but denying involvement in the violence.

Even though he was widely known to be a primary suspect, he made no attempt to flee Benghazi. He was later captured, interrogated for days aboard the warship New York as it steamed across the ocean, then charged with multiple counts, including murder, destruction of federal buildings and providing support to terrorism. His trial is expected to take about five weeks, and include surveillance video clips and eyewitness testimony reconstructing the attacks, the role he is accused of playing and his eventual capture.

Mr. Khatalla, who faces a potential sentence of life in prison if convicted, has pleaded not guilty. His lawyers will most likely try to cast suspicion on others who were at the consulate that night to deflect blame from their client. The Justice Department has charged at least a dozen people under seal in the attacks, officials say.

The attacks crystallized Libya’s descent into chaos after the 2011 Arab Spring uprising, which, with help from NATO air power, had toppled the country’s longtime dictator, Col. Muammar el-Qaddafi.