Ambassador Fawaz al-Itan, Jordan's kidnapped ambassador to Libya, has been freed by his captors in exchange for the release of a fighter held over a plot to attack Jordan's major airport.
Itan was freed and returned home to Amman, the Jordanian capital, on Tuesday.
He was greeted by relatives and officials led by Prince Faisal bin Hussein, the brother of King Abdullah II, as he arrived by plane to Marka military airport in Amman.
"They [the kidnappers] treated me in a civilised and humane manner," Aitan told reporters after stepping off the aircraft, looking healthy but tired, according to the AFP news egancy.
Itan was kidnapped in Tripoli last month by gunmen who demanded fighter Mohamed Darsi be released from a Jordanian jail in exchange for the diplomat's freedom.
Darsi was jailed for life in 2007 for plotting to blow up the main airport in Jordan.
Khaled al-Kalaldah, Jordan's minister for parliamentary affairs, said "last week, Mohammed Saeed al-Darsi was handed over to Libyan authorities in accordance with an agreement" with the Libyan side.
Al Jazeera's Nisreen El-Shamayleh, reporting from Amman, said there was fear in Jordan - an important US ally in the fight against al-Qaeda - that the incident could encourage kidnappers to seize Jordanian officials and seek ransom.
Kidnappings have become commonplace in Libya, with foreign diplomats often the targets.
Diplomats in Tripoli say militias which fought to topple Muammar Gaddafi's regime in the 2011 uprising often carry out kidnappings to blackmail other countries into releasing Libyans held abroad.
Two Tunisians, a diplomat and an embassy colleague, have also been abducted in Libya, and Tunis has said their kidnappers are demanding the release of Libyans jailed in Tunisia on terrorism charges.
On Thursday, the government in Tripoli said the justice ministries of both Jordan and Libya had ratified the agreement to extradite prisoners. It did not elaborate.