Libyan Prime Minister Ali Zeidan has given a speech live on television calling on Libyans to avoid escalation of tension after he was seized by a militia group and later released.
In his address, Mr Zeidan thanked rebels who helped in his release and urged them to join the regular armed forces.
He said: "Libyans need wisdom ... not escalation to deal with this situation."
Initially, the group, known as the Operations Room of Libya's Revolutionaries, said it seized Mr Zeidan over his government's role in the US capture of a top al-Qaeda suspect in the Libyan capital.
The militia, which had been hired by the government to provide security in Tripoli, said it "arrested" Mr Zeidan after US Secretary of State John Kerry confirmed Libya's role in the weekend capture in the city of Anas al-Liby.
However, a Libyan security official subsequently said the detention was in relation to citizen complaints against Mr Zeidan rather than in reprisal for the capture of Mr Liby.
Mr Zeidan was reportedly held at the Interior Ministry's anti-crime department.
The incident comes just days after the prime minister had sought help from western powers to stop the spread of militancy in his country.
Guards at the Corinthia Hotel said gunmen had taken Mr Zeidan from the hotel, but there were no shots fired or clashes during the incident.
Al-Arabiya television channel showed what it said were video stills of Mr Zeidan frowning and wearing a grey shirt undone at the collar surrounded by several men in civilian clothes pressing closely around him.
Two years after a revolution toppled Libya's Colonel Muammar Gaddafi, the central government has been struggling to contain rival tribal militias and Islamist militants who control parts of the country.