Saif al-Islam Gaddafi, second son of the late deposed Libyan leader Col Muammar Gaddafi, has been freed from jail under an amnesty law.
His father’s preferred successor, he had been held by a militia in the town of Zintan for the past six years.
The Abu Bakr al-Siddiq Battalion said he had been released on Friday but he has not been seen in public.
It is feared the move could fuel further instability in Libya.
His lawyer, Khaled al-Zaidi, confirmed he had been released.
He declined to say which city Saif al-Islam had travelled to for security reasons. A source has told the BBC he is in the Tobruk area of eastern Libya.
The Abu Bakr al-Siddiq Battalion said it was acting on a request from the "interim government" based in the east of the country.
However, he has been sentenced to death in absentia by a court in Tripoli, in the west of the country, where control is in the hands of the rival, UN-backed Government of National Accord.
Saif al-Islam is wanted by the International Criminal Court for crimes against humanity during his father’s unsuccessful attempts to put down the rebellion against his rule.
The Zintan Military Council - which had previously been involved in his detention - and Zintan’s municipal council have condemned his release by the Abu Bakr al-Siddiq Battalion.
The councils said in a statement that freeing Saif al-Islam was "a form of collusion, a betrayal of the blood of the martyrs and stab in the back of the military body to which they [the brigade] claim to belong".
Another unpredictable element: analysis by Orla Guerin, BBC News, Tripoli
The release of Saif al-Islam Gaddafi will add another unpredictable element to Libya’s unstable mix.
He was detained in the desert in November 2011 trying to flee to Niger, and later appeared missing several fingers.
The former playboy often appeared in the West as the public face of the Gaddafi regime and was his father’s heir-apparent.
While reviled by many - at home and abroad - he retains some support in Libya and could try to re-enter the political fray here.
The 44-year-old Saif al-Islam - who was controversially granted a PhD by the London School of Economics in 2008 - was captured in November 2011 after three months on the run following the end of Muammar Gaddafi’s decades-long rule.
He was previously known for playing a key role in building relations with the West after 2000, and had been considered the reformist face of his father’s regime.
But after the 2011 uprising, he found himself accused of incitement to violence and murdering protesters.
Four years later, he was sentenced to death by firing squad following a trial involving 30 of Gaddafi’s close associates.
Reaction on social media to Saif al-Islam’s release has been mixed.
One Twitter user said: "When the world is upside down, the killer becomes innocent and the victim becomes a terrorist. The blood of the martyrs disappears and Saif al-Islam becomes a free man!"
By contrast, another Twitter user posted a video showing celebrations of Saif al-Islam’s release in the north-western town of Asabea, in which people appeared be carrying the green flags associated with his father’s rule. He was also described as a "lifeline to the Libyan people".
Saif al-Islam: Heir to prisoner
June 1972: Born in Tripoli, Libya, second son of Libyan leader Colonel Muammar Gaddafi
February 2011: Uprising against Gaddafi government begins
June 2011: International Criminal Court issues an arrest warrant for Saif al-Islam for crimes against humanity
August 2011: Leaves the capital after Tripoli falls to anti-government forces; flees to Bani Walid
October 2011: Father and younger brother killed
19 November 2011: Captured by militia as he tries to flee south to Niger. Imprisoned in Zintan
July 2015: Sentenced to death by a Tripoli court in absentia
June 2017: Reportedly released after being granted amnesty by one of Libya’s two competing governments