Ahmed Abu Khattala at his arriagnment hearing at the US. District Court, where he appeared for less than five minutes before entering a plea of not guilty on June 28, 2014. (Illustration by Richard Johnson/The Washington Post)

Ahmed Abu Khattala, one of the suspected ringleaders of the 2012 attacks in Benghazi, Libya, voiced opposition to the presence of a U.S. facility there in the days before the assault and organized the attacks out of a sense of ideological fervor, according to government prosecutors.

After the attack on the U.S. diplomatic mission in Benghazi, Abu Khattala and other armed men entered and looted the compound, then returned to a camp to begin preparations for an attack on a nearby CIA annex, prosecutors said in court documents filed late Tuesday. The two attacks resulted in the deaths of four Americans, including U.S. Ambassador J. Christopher Stevens.

Abu Khattala, who was indicted Saturday on a charge of conspiracy, will appear Wednesday morning in U.S. District Court in Washington for a detention hearing before Magistrate Judge Deborah A. Robinson.

“There is no condition or combination of conditions that will reasonably assure the defendant’s appearance in court and assure the safety of any person and the community,” U.S. Attorney Ronald C. Machen Jr. wrote in a motion in favor of pretrial detention.

U.S. officials said they consider the conspiracy charge, which carries a maximum penalty of life imprisonment, a “place holder” to avoid revealing more evidence in the case while a search for witnesses continues. In the coming weeks, a superseding indictment is expected to bring additional charges, including ones that carry the death penalty. Abu Khattala has pleaded not guilty.

Ahmed Abu Khattala, Libyan militia leader and alledged mastermind behind the deadly 2012 Benghazi attack, pled not guilty to terror charges in a U.S. District Court Saturday. (Reuters)

Tuesday’s court filing is a preview of the case that prosecutors are building against Abu Khattala, the only suspect in the Benghazi attacks to be apprehended and one of the most significant terrorism suspects to face U.S. trial in recent years. According to a U.S. official who has reviewed the case against Abu Khattala, the evidence includes photographs and video from the attacks, testimony from witnesses, and evidence of the attacks’ planners boasting of their involvement.

Abu Khattala was seized June 15 in Benghazi by U.S. Special Operations forces, 21 months after the fiery attacks on the U.S. facilities there. In the new court documents, prosecutors said for the first time that Abu Khattala was armed with a loaded handgun when he was detained.

He was taken to a U.S. Navy warship, where he was questioned by intelligence and law enforcement officials. While aboard the vessel, the USS New York, Abu Khattala spoke freely with his interrogators both before and after he was read his Miranda rights, U.S. officials said, although they have declined to describe the nature of any information he provided. He was later transferred by helicopter to the Washington area.

The exact cause of the attacks in Benghazi became the source of a bitter political dispute in Washington, in part because U.S. officials initially said it had begun as one of a number of spontaneous anti-U.S. street demonstrations sweeping across the Arab world as protesters denounced an anti-Muslim Internet video. The Obama administration later labeled what happened in Benghazi a terrorist attack.

In their motion, prosecutors alleged that Abu Khattala’s motivation to attack the U.S. facilities sprang from his extremist anti-Western views. “In the days before the Attack, the defendant voiced concern and opposition to the presence of an American facility in Benghazi,” prosecutors stated. They said many of his associates in the Ansar al-Sharia militia have been identified as being among a group of 20 or more armed men who gathered outside the U.S. mission on Sept. 11, 2012, and who later “aggressively breached the gate” before entering the facility, setting fire to the property and stealing a U.S. vehicle.

After the attack, according to the court documents, Abu Khattala “supervised the exploitation of material from the scene by numerous men.”

In the days that followed the Benghazi attacks, prosecutors said, Abu Khattala tried to obtain equipment and weapons to defend himself from possible U.S. retaliation.

U.S. Special Operations forces have captured Ahmed Abu Khattala, an alleged ringleader of the 2012 attacks on the U.S. diplomatic compound in Benghazi, Libya. Here is what is known about Khattala. (The Washington Post)

Late last year, he expressed anger that U.S. forces had captured Nazih Abdul-Hamed al-Ruqai, also known as Anas al-Libi, in Tripoli in connection with the 1998 bombings of the U.S. embassies in Kenya and Tanzania.

According to prosecutors, Abu Khattala then took steps to retaliate against the United States by targeting American interests in the region. He allegedly has extensive contacts with senior members of extremist groups in Libya, including close associates who participated in the Benghazi attacks.

He also increased his personal security, the court document said, because he was afraid that U.S. forces might try to capture him in Libya, as they eventually did.

Abu Khattala is being held in the Alexandria detention center. Wednesday’s pretrial detention hearing is scheduled for 11 a.m.

Rachel Weiner contributed to this report.