Read Time:4 Minute, 7 Second
The US, UK and France, along with the UN, have condemned the brief abduction of Libya's PM and pledged their support for its transition to democracy.
US Secretary of State John Kerry called the act "thuggery", while UN Secretary General Ban Ki-moon urged all Libyans to respect the rule of law.
Ali Zeidan was abducted from a Tripoli hotel and held for several hours by armed militiamen.
He praised the armed groups that came to rescue him and has called for calm.
The motive of the abduction is unclear but some militias had been angered by last Saturday's US commando raid in Tripoli to capture senior al-Qaeda suspect Anas al-Liby.
Many militias are under the pay of the defence or interior ministries – in the absence of an effective police force or military – but their allegiance and who really controls them is in doubt.
'Calm and measured'
The US denounced the kidnapping.
Mr Kerry said: "Libyans did not risk their lives in their 2011 revolution to tolerate a return to thuggery.
"Today's events only underscore the need to work with Prime Minister Zeidan and with all of Libya's friends and allies to help bolster its capacity with greater speed and greater success."
Mr Kerry said there could be "no place for this kind of violence in the new Libya".
A statement on behalf of Mr Ban said Libya was facing a deteriorating security situation and increasing acts of violence.
It read: "The secretary-general calls on all Libyan parties and the Libyan people to form consensus around national priorities and work towards building a strong, stable country, respectful of the rule of law and the protection of human rights."
France and Britain both pledged swift support for Mr Zeidan.
French President Francois Hollande said he stood ready to strengthen ties with Libya to tackle militants.
"We must be there to co-operate with Libya to put an end to these groups," he said.
A spokesperson for David Cameron said the UK prime minister had spoken to a "calm and measured" Ali Zeidan after his release and had promised to help build a "stable, free, peaceful and prosperous" Libya.
The spokesperson said the two leaders discussed the challenges facing Libya.
"We have always known and said these transitions clearly take time, transition after a very long period of ruthless authoritarian dictatorship. I think the key thing is to continue to support that country," the spokesman said.
The identity of the militiamen who abducted Mr Zeidan remains unclear.
One group, the Libya Revolutionaries Operations Room (LROR), said it had captured Mr Zeidan, claiming it was acting on orders from the prosecutor general. But the justice ministry denied this.
The official Lana news agency also named another formal rebel group, the Brigade for the Fight against Crime, as being involved.
The government has been struggling to contain the numerous militias who control many parts of the country.
Two years after the overthrow of Col Muammar Gaddafi, Libya still has no constitution and divisions between secular and Islamist forces have paralysed parliament.
Mr Zeidan was taken in a pre-dawn raid on the Corinthia Hotel by more than 100 armed men.
Photographs showed Mr Zeidan being surrounded and led away. There were no reports of violence during his capture.
The prime minister was reportedly held at the interior ministry anti-crime department in Tripoli, where an official said he was treated well.
The BBC has been told that local armed residents backed by brigades from nearby districts had rescued the PM, our correspondent in Tripoli, Rana Jawad, says.
The PM later appeared at a cabinet meeting broadcast live on Libyan television.
He thanked those who had taken part in the security operation to free him.
Mr Zeidan said: "I salute the revolutionaries who had an important role. The real revolutionaries, those who rose above greedy demands."
The prime minister said of his capture: "These are accidental things from the revolution's overflow and they will disappear."
Mr Zeidan assured foreigners the incident had happened "within the context of Libyan political wrangles".
Many militia groups saw the US raid in Tripoli on Saturday as a breach of Libyan sovereignty.
Mr Liby, 49, had been living openly in Tripoli before his capture.
He is believed to have been one of the masterminds behind the 1998 US embassy attacks, which killed more than 220 people in Kenya and Tanzania.
In remains unclear whether the Libyan government had prior knowledge of the US commando operation.