Image copyright Reuters Image caption Gunmen raided the consulate and set it on fire

The suspected ringleader of the September 2012 raid on a US diplomatic post in the Libyan city of Benghazi, which left four Americans dead, has been captured, the Pentagon says.

Ahmed Abu Khattala was taken into custody in a secret US military raid in Libya on 15 June.

He is now being held in a secure location outside the country, a Pentagon spokesman confirmed.

US Ambassador Chris Stevens and three others were killed in the attack.

"There were no civilian casualties related to this operation, and all US personnel involved in the operation have safely departed Libya," Pentagon press secretary Rear Adm John Kirby wrote in a statement.

He refused to give further details about the US raid, only to say it happened "near Benghazi" and on Sunday afternoon US east coast time.

Ahmed Abu Khattala

•Native of Benghazi in eastern Libya

•Construction worker by trade

•Spent several years in Col Muammar Gaddafi's notorious Abu Salim prison in Tripoli

•Formed his own small militia during the anti-Gaddafi uprising

•Denies any links to al-Qaeda but has expressed admiration for it

•Also denies any role in the attack on the US embassy in 2012, but eyewitnesses report him being there

•US state department says he is a senior leader in Islamist group Ansar al-Sharia

After the announcement, President Barack Obama praised the courage and professionalism of the military, law enforcement and intelligence personnel who tracked and captured Mr Abu Khattala, whom the US describes as a "key figure" in the attack.

"When Americans are attacked, no matter how long it takes we will find those responsible and we will bring them to justice," he said.

Media playback is unsupported on your device Media caption President Obama: "When Americans are attacked, no matter how long it takes, we will find those responsible and we will bring them to justice''

The FBI Director, James Comey, said his organisation would not stop searching until the other suspects were found.

"We never ever give up and we will work and work until justice is done. And I think this is a down payment on that statement."

Mr Abu Khattala has been charged in a federal court in Washington DC with killing a person in the course of an attack on a federal facility, providing material support to terrorists, and a firearms count, court records show.

He is currently being held on a US ship, Reuters reports. Some Republicans, including Senators Lindsay Graham and John McCain, have argued he should be sent to the US military prison in Guantanamo Bay. But US officials rejected that move.

"We have not added a single person to the GTMO population since President Obama took office, and we have had substantial success delivering swift justice to terrorists through our federal court system," National Security Council spokeswoman Caitlin Hayden said in a statement.

Hillary Clinton, who was secretary of state at the time and been criticised by Republicans over the embassy's security arrangements, said questioning Khatalla could shed some light on what happened and why.

On 11 September 2012, gunmen stormed the US consulate in Benghazi and set it on fire.

In addition to Mr Stevens, information technology specialist Sean Smith and security workers and ex-Navy Seals Tyrone Woods and Glen Doherty were killed.

The White House initially said the attack stemmed from anti-American protests over a crude video produced in the US that was deemed insulting to Islam.

Analysis

Rana Jawad, BBC News, Libya

This is the second raid of its kind to be carried out by American special forces on Libyan territory.

Ahmed Abu Khattala is an Islamist militia commander who heads the Benghazi-based Ansar Al Sharia group. A source close to the hard-line Islamist group told the BBC they knew he was captured two days ago but were not aware the Americans were going to take him.

He claims Abu Khattala's capture was carried out by forces led by the renegade Gen Khalifa Hefter in Benghazi. This could not be independently confirmed.

Gen Hefter has been leading a paramilitary operation in Benghazi against Islamist militias for a month. On 15 June his spokesman claimed they had captured three senior Islamist figures in the city. In October, an American-led operation captured the alleged al-Qaeda operative Abu Anas al-Libi from his home in Tripoli. He is now on trial in New York.

Government investigators soon determined it was an organised attack planned by local militias.

In subsequent years, the incident has become a political lightning rod, with Republicans accusing Mr Obama's administration of covering up the involvement of militant groups in the days after the attack in order to assist Mr Obama's 2012 re-election campaign.

In May, the Republican-led House of Representatives voted to establish what is believed to be the eighth inquiry on Benghazi.

Previous independent, cross-party and Republican-led inquiries have blamed the state department for inadequate security at the embassy.