Libyan PM Ali Zeidan has called for "calm and "wisdom" after being freed from the custody of militiamen.
He was abducted from a Tripoli hotel and held for several hours by armed men whose identity has yet to be confirmed.
In a televised cabinet meeting, the PM thanked those who freed him, suggesting there had been a security operation.
The motive of the abduction is unclear but some militias had been angered by a US commando raid to capture senior al-Qaeda suspect Anas al-Liby.
Many militia groups saw the raid in Tripoli on Saturday as a breach of Libyan sovereignty and there is growing pressure on the government to explain if it was involved.
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 LROR said its actions had not been related to Mr Liby's detention.
The official Lana news agency also named another formal rebel group, the Brigade for the Fight against Crime, as being involved.
Two years after the overthrow of Col Muammar Gaddafi, Libya still has no constitution and divisions between secular and Islamist forces have paralysed parliament.
The government has been struggling to contain the numerous militias who control many parts of the country.
Mr Zeidan's cabinet meeting following his release was shown live on Libyan television.
He thanked those who had helped free him but gave no details about them or the abductors.
"We hope this matter will be treated with wisdom and rationality, far from tension," he said. "There are many things that need dealing with."
State TV had also earlier broadcast live Mr Zeidan's return to his office in Tripoli.
There was a high security presence as his car pulled up outside.
Mr Zeidan had been taken in a pre-dawn raid on the Corinthia Hotel by more than 100 armed men.
Photographs circulating online showed Mr Zeidan surrounded by what state TV said were armed men as he was led away. There were no reports of violence during his capture.
In claiming it carried out the attack, the LROR said it was acting on the orders of the prosecutor general and in accordance with a section of Libya's criminal code relating to "crimes and misdemeanours harmful to state security".
But Justice Minister Salah al-Marghani said the prosecutor general had issued no arrest warrant, according to state-run National Libyan TV.
The prime minister was reportedly held at the interior ministry anti-crime department in Tripoli, where an official said he was being treated well.
In a news conference shortly before the release was announced, the government condemned the "criminal act" of his detention and said it would not give in to "blackmail".
The LROR is one of a number of militias operating in Libya which are nominally attached to government ministries but often act independently and, correspondents say, often have the upper hand over police and army forces.
Earlier this week, the prime minister appealed for Western help in tackling rising militancy in Libya.
In an interview with the BBC on Monday, he said Libya was being used as a base to export weapons throughout the region.
Mr Liby, 49, 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.
He was living openly in Tripoli before his capture by US commandos early on Saturday morning.
In remains unclear whether the Libyan government had prior knowledge of the operation to capture him.
Libya asked the US for clarification of the incident and has questioned the US ambassador, but the PM also said it would not harm ties with Washington.
Libyan PM Ali Zeidan has called for "calm and "wisdom" after being freed from the custody of militiamen. He was abducted from a Tripoli hotel and
Ex-Liberian President Charles Taylor is to serve his 50-year war crimes sentence in the UK, Justice Minister Jeremy Wright has confirmed. Finland, Rwanda and Sweden were
Most Watched VideosView all posts
Liberia’s flourishing post-war art
Bela Fleck: Throw Down Your Heart Trailer
A Nigerian man is in FBI custody in Los Angeles after flying from New York's JFK Airport to Los Angeles International Airport without a valid
This video concentrates on the practice of female circumcision in the Afar Tribe, and contains subjects some viewers may find distressing. Lana Inglis
Most Read NewsView all posts
Most Watched Movies
Features: Mercy Johnson, Oge Okoye, Ruth Kadiri, Prince Eke, Shirley Igwe
Ngige(Nwani Okolo) kills a prostitute for money, who before dying, lays a curse on him and his family. Starring: Eucharia Anunobi, Chiege Alisigwe, Charles Okafor, Chinwe
Sequel to Strange Act. Synopsis: Ben and Anita, played by Nonso Diobi and Chike Ike respectively, are exes who are reunited one day by a chance meeting in a restaurant. Ben
A young man(Nonso Diobi) dumped his faithful love(Stella Anyika) for his lust for a one night stand. Did he pick a very lively girl or
Features: Jackie Appiah, Kalsoum Sinare, Akuba Morkeh. Jackie Appiah is a young lady facing death row because of her dark past. She blames the Lord
Features:Yvonne Nelson, Yvonne Okorro, James Gardiner, Ekow Smith Asante, Kalsum Sinare Goldie Zenneth (Yvonne Nelson) thinks the world revolves around her. She will go
Sequel to Secret Act. Features: Emeka Ike, Chika Ike, Eucharia Aunuobi Secret Act is a story of a young family whose happiness got truncated by a series
Features: MIKE EZURONYE, NGOZI EZEONU, YUL EDOCHIE, CHINWETALU AGWU.Enyioma (Mike Ezuruonye) and his friend Osondu (Yul Edochie) were driving down the road and