Ali Zeidan
A Video broadcasted by Al-Arabiya allegedly showing Prime Minister Ali Zeidan at the time he was taken from his hotel (Courtesy of Al-Arabiya)

The Libyan government said PM Ali Zeidan has been freed hours after being abducted by gunmen from his Tripoli hotel.

A government spokesman told state news agency LANA that Zeidan has been "set free" and was on his way to his office.

A government official said Zeidan, with two of his guards, was taken by gunmen in a dawn raid at the luxury Corinthian Hotel where he resided in the Libyan capital.

The two guards were beaten but later released.

Witnesses said that up to 150 gunmen drove up in pickup trucks and laid siege to the hotel before daylight. They broke into the hotel and some headed to the 21st floor where the prime minister was staying.

The gunmen scuffled with the prime minister's guards before seizing him and leading him out. Zeidan reportedly offered no resistance.

A Libyan militia group had claimed responsibility for the abduction, saying it "arrested" Zeidan because he allowed the US military to capture a top al-Qaida leader in Tripoli.

"His [Zeidan's] arrest comes after the statement by [US Secretary of State] John Kerry about the capture of Abu Anas al-Libi, after he said the Libyan government was aware of the operation," The Libyan Revolutionary Operations Chamber said.

Nazih Abdul-Hamed al-Ruqai, known by his alias Anas al-Libi, was snatched by a US commando unit as he was returning to his Tripoli house earlier this week.

Al-Libi is believed to be the mastermind behind the 1998 bombings at American embassies in Kenya and Tanzania.