Zeidan says Libyans need wisdom after brief but dramatic ordeal that saw him taken from his hotel room by armed men

The Libyan prime minister, Ali Zeidan, has called for calm after being released by rebels who kidnapped him in the early hours of Thursday morning.

"Libyans need wisdom … not escalation … to deal with this situation," he said during a televised cabinet meeting in which he thanked those rebels who helped in his release and urged them to join the regular armed forces.

Zeidan was returned under armed escort to the Tripoli hotel from where he was seized in a brief but dramatic kidnapping. He was taken from his room at 4am by armed men who escorted him from the Corinthia hotel and held him captive.

Libyan television showed him returning to his Tripoli office at about 1.30pm local time (12.30pm BST) wearing a business suit and flanked by dozens of soldiers in red berets. In his brief TV statement, Zeidan gave no details about his ordeal and avoided pointing fingers at those behind the abduction. Associated Press quoted him as saying: "We hope this matter will be treated with wisdom and rationality, far from tension. There are many things that need dealing with."

In a 10-minute phone call with Zeidan following his release, David Cameron said Britain would continue to support Libya in its transition from the rule of the late dictator Muammar Gaddafi.

The prime minister's spokesman said: "They talked about how the UK would continue to support the Libyan government and Libyan people during this challenging transition, including support in helping them overcome the security challenges they face and that are so important in overcoming in order to achieve the kind of stable free, peaceful and prosperous Libya."

He said Cameron wanted to make clear that Britain would continue to offer support in training members of the security forces, including reintegrating militia forces. Asked about the condition of the Libyan prime minister, the spokesman said: "He was calm and very measured throughout the call."

Militia units, which had taken charge of security outside the hotel after police fled in the morning, withdrew following Zeidan's return and police units in red-and-white jeeps were again deployed around the entrance.

The situation at the hotel was tense, with dozens of armed men from police, army and pro-Zeidan militias clustered at the entrance bearing machine guns and rocket launchers. Inside, guests could be seen standing around the lobby looking out at the security forces.

Condemnations of the kidnapping came from the foreign secretary, William Hague, the United Nations support mission in Libya, and the Muslim Brotherhood's Justice and Construction party.

Human Rights Watch said it was "deeply troubled" by Zeidan's detention by "armed forces apparently aligned with the state".

It said in a statement: "His brief detention clearly violated Libyan law. The incident highlights the grave security conditions in Libya today. Hopefully it will refocus attention on the urgent need to strengthen both the country's security forces and its judicial systems."

It is still unclear who kidnapped Zeidan: Hashim Bishar, head of the Tripoli Supreme Security Committee, the government's gendarmerie, claimed the prime minister was captured by an unidentified group and then released from his detention by Tripoli militias.

"Our revolutionaries went to the place where he was being detained and demanded he be handed over. He was handed over, now he is safe," he told a Libyan TV station. He did not say who had kidnapped Zeidan.

The abduction came amid anger among Libya's powerful Islamic militant groups over the US special forces raid on Saturday that seized the Libyan al-Qaida suspect known as Abu Anas al-Liby.

Several groups and Liby's family members have accused the government of complicity in the American raid, though Zeidan has denied all knowledge of the operation.

The state news service Lana had earlier said that Zeidan was captured by the Revolutionary Operations Room of Libya, a government security force composed of former rebels, reporting that a statement from the group said he would be charged under the Libyan penal code with endangering state security. The group denied any involvement in the operation.

The British embassy closed its office in Tripoli on Thursday without explanation.

The Libyan government denied that Zeidan faced an arrest warrant. "The head of the transitional government, Ali Zeidan, was taken to an unknown destination for unknown reasons," it said on its website while the interim prime minister was being held captive, attributing the kidnapping to former rebels.

Militia guards outside the hotel had said Zeidan was "arrested" and that they were volunteers who had arrived to protect the hotel after the police units left. Witnesses said Zeidan's bodyguards and hotel security units took no action as he was taken from the hotel.

Hassan al-Amin, a former dissident who chaired Libya's congressional human rights commission until he fled to the UK last year after militia death threats, condemned claims by Zeidan's kidnappers that they were revolutionaries.

"There are no revolutionaries now: the people who did this are froukk [immature]," he said. "They have betrayed the martyrs and they have betrayed everything that the February 17 revolution [2011 Arab Spring] stands for."

The Corinthia hotel is seen by foreigners as a safe haven in a city prone to kidnappings. Qatar is among a clutch of countries which have moved their embassies there and the European Union support mission is based there. Despite the kidnapping, it was business as usual at the seafront, with diplomatic vehicles arriving and leaving and guests meeting in the coffee bar and foyer.

In August, an escort car of the European Union's ambassador came under fire at the Corinthia's front gate and in June a rocket was fired at the hotel, missing and striking a nearby building.

Hours before the kidnapping, Zeidan met family members of Liby.

Both Libya's main parties, the Muslim Brotherhood's Justice and Construction Party and the centre-right National Forces Alliance have condemned the US operation that captured Liby.

On Monday, soldiers complaining that they had not been paid occupied Zeidan's Tripoli office.

Most of Libya's oil production has been at a standstill since July, with striking troops in the east and tribal militias blockading ports and oilfields, claiming oil revenues are being misspent.

The Justice and Construction party has led efforts in the General National Congress to have Zeidan dismissed, accusing him of failing to tackle militia violence, the oil strikes and a moribund economy.