Image copyright Reuters Image caption The US compound in Benghazi was attacked on 11 September 2012

A US court has jailed a Libyan militant who was involved in the 2012 attack on an American compound in the city of Benghazi for 22 years.

Prosecutors had said Ahmed Abu Khattala was the ringleader of the attack, which killed the ambassador and three others.

But he was found guilty of lesser charges.

He is the first person to be tried over the attack, which was a focus for criticism of Hillary Clinton during the 2016 US election.

Ms Clinton was accused of failing to protect US diplomats during her time as secretary of state.

The US justice department said Khatallah led an extremist militia called Ubaydah bin Jarrah and directed it to carry out the violence in Benghazi.

Khattala was convicted in November on four of the 18 charges he faced - conspiracy to provide material support to terrorists, providing material support to terrorists, maliciously destroying property, and using and carrying a semiautomatic weapon during a violent crime.

However he was acquitted of murder and other charges.

Ambassador Christopher Stevens and a state department technician died of smoke inhalation when armed men set fire to a building in the diplomatic compound.

The attackers later fired mortar rounds at a CIA building, killing two former Navy Seals.