Former rebels have freed Libya's prime minister after holding him for several hours in reprisal for the capture by US forces at the weekend of a Libyan al-Qaeda suspect in Tripoli.

Shortly after being released on Thursday, Ali Zeidan called on all Libyans to avoid escalation and assured foreign visitors that their safety is not in question.

The rebel group accused the prime minister of bribery dating back to September, saying Zeidan issued cheques to military guards who had been blocking an oil refinery in east Libya.

Zeidan was seized at dawn from a luxury hotel where he lives under tight security and was held for about six hours.

Two years after a revolution ended Muammar Gaddafi's 42-year rule, Libya is in turmoil, with its vulnerable central government and nascent armed forces struggling to contain rival tribal groups and fighters who control parts of the country.

Speaking to Al Jazeera from London, Middle East analyst Abdel Bari Atwan said the incident confirmed that "Libya is a failed state".

"The rebels have the upper hand and the army cannot intervene. It is chaos. This is a huge embarrassment for the government," Atwan said.

The rebel group, Libyan Revolutionary Operations Chamber, which had been hired by the government to provide security in Tripoli, said it "arrested" Zeidan after US Secretary of State John Kerry said Libya had a role in the weekend capture in the city of Abu Anas al-Liby.

"His arrest comes after ... (Kerry) said the Libyan government was aware of the operation," a spokesman for the group said.

Before his release, an official in the Interior Ministry's anti-crime department told the state news agency that Zeidan, a former diplomat and an anti-Gaddafi activist who spent years in exile, was being held there and was being treated well.

The prime minister, who is in his early 60s, was taken from the Corinthia Hotel, where many diplomats and top government officials live. It is regarded as one of the most secure places in Tripoli.

US special forces raid

US special forces on Saturday seized Nazih al-Ragye, known by his alias Abu Anas al-Liby - a Libyan suspected in the 1998 bombings of US embassies in Kenya and Tanzania.

Liby is being held on a Navy ship in the Mediterranean Sea.

After Zeidan was seized, the US State Department said it was "in close touch with senior US and Libyan officials on the ground".

The Libyan Revolutionary Operations Chamber had been affiliated with the Interior Ministry which assigned them to provide security in the capital as part of a programme to reintegrate former fighters.

Guards at the hotel said there were no shots fired or clashes during the incident.

The capture, however brief, raised the stakes in the unruly OPEC nation, where the regional factions are also seeking control over its oil wealth, which provides Libya with the vast bulk of government revenues.

Brent oil prices rose on the news.

"Everybody is watching this... We still haven't seen any disruption to supply from Libya, so we don't expect a spike in prices," said Ken Hasegawa, a commodity sales manager at Newedge Japan.

A mix of striking workers, fighters and political activists have blocked Libya's oilfields and ports for more than two months, according to Oil Minister Abdelbari Arusi, resulting in over $5bn of lost revenues.

He said on October 2 that oil exports could return to full capacity in days once the strikes ended.