Libyan authorities have released Saadi Gaddafi, a son of the former leader Muammar Gaddafi who was ousted and killed during a 2011 uprising.
Saadi Gaddafi fled for Niger during the NATO-backed uprising, but was extradited to Libya in 2014 and has been imprisoned since then in Tripoli.
He immediately departed on a plane to Istanbul, an official said.
Libya has suffered chaos, division and violence in the decade since the uprising.
The Government of National Unity was installed in March as part of a peace push that was also meant to include elections planned for December.
His release resulted from negotiations that included senior tribal figures and Prime Minister Abdulhamid Dbeibeh, the official said.
Another official said the negotiations also involved former interior minister Fathi Bashagha.
Saadi Gaddafi, 47, was known for his playboy lifestyle during his father's dictatorship.
A former professional footballer in Italy, he had been held in a Tripoli prison, accused of crimes committed against protesters and of the 2005 killing of Libyan football coach Bashir al-Rayani.
In April 2018, the court of appeal acquitted him of Mr Rayani's murder.
Who's left of the Gaddafi clan and where are they?