A Libyan militant who prosecutors portrayed as the mastermind behind the deadly 2012 attacks on U.S. government facilities in Benghazi was sentenced by a federal judge to 22 years in prison on Wednesday, according to a statement from the Justice Department.

Ahmed Abu Khattala, 47, was convicted by a jury in November of four counts related to the attack on a CIA compound that killed four Americans including a U.S. ambassador. Charges included conspiracy to provide material support to terrorists.

ADVERTISEMENT

U.S. District Judge Christopher R. “Casey” Cooper rejected prosecutors' demand for a life sentence, ruling closer to the defense's request for a 15-year sentence.

“Even if you did not pour the gasoline or light the match, the evidence showed you were aware of the attack, and once the gates were breached, the likelihood someone would die was extreme high. This was not guilt by association,” Cooper told Abu Khattala, according to The Washington Post.

“This case stands as an exemplar for the principle that a defendant accused of international terrorism can get a fair trial in the U.S. criminal justice system.”

Federal prosecutors hoped in court filings for a sentence that would deter future attacks on U.S. ambassadors, as Ambassador to Libya Chris Stevens was the first U.S. diplomat to be killed on duty in decades.

“This fact alone, the first killing of a U.S. Ambassador while in the performance of his duties in nearly 40 years, makes this case a truly singular event and warrants imposition of the maximum sentence permissible under the law,” Assistant U.S. Attorney Michael DiLorenzo wrote in court filings.

Defense attorneys sought to cast doubt during Abu Khattala's trial over how large a role the militant played in the 2012 attack.

Congressional Republicans laid blame for the success of the attack at the feet of then-Secretary of State Hillary Clinton Hillary Diane Rodham ClintonDemocratic groups using Bloomberg money to launch M in Spanish language ads in Florida The Hill's Campaign Report: Presidential polls tighten weeks out from Election Day More than 50 Latino faith leaders endorse Biden MORE, who they accused of failing to ensure the compound had proper security.