He was released in the town of Zintan under an amnesty law passed by a parliament based in eastern Libya, lawyer Khaled al-Zaidi said on Sunday, adding that Saif was headed to another city which could not be named for security reasons.
Saif, 44, is the most prominent of the late leader's children, and was touted by some as a possible successor before the uprising six years ago in which Gaddafi was toppled and killed.
It is unclear what role the younger Gaddafi could play in Libya, where a complex array of armed groups and competing governments are vying for control.
But some in eastern Libya, where military commander Khalifa Haftar has been building power, have been pressing for Saif's release amid a push from former regime figures to reassert influence.
Earlier reports that Saif had been freed from Zintan turned out to be false and there have been conflicting reports about his status.
Zintan's Abubaker Sadiq brigade, which was responsible for guarding Saif, said it had decided to release him following requests from the ministry of justice of a government based in eastern Libya.
"We decided to release Saif al-Islam Muammar Gaddafi, who is free, and we confirm that he left Zintan on the date of his release on the 14th of Ramadan (Friday)," the brigade said.
A Tripoli court sentenced Saif to death in 2015 for war crimes, including killing protesters during the revolution.
Zintan, which grew powerful through its role in the 2011 uprising and has been at odds with authorities in Tripoli, had refused to hand Saif over. He is also sought by the International Criminal Court, which says his trial in Libya did not meet international standards.
It was unknown what terms Saif's captors might have set for his release, and why they would have freed a prisoner seen as a major bargaining chip.
Zintan, about 145 km (90 miles) southwest of Tripoli, has its own divisions, but it has been broadly aligned with the government and armed forces based in eastern Libya.
A statement from Zintan's military and municipal councils strongly condemned the decision to release Saif.
It said the move had "nothing to do with the legal procedures, but is collusion and betrayal of the blood of the martyrs and the military institution that they claim to belong to".
(Additional reporting by Ahmed Elumami in Tripoli; writing by Aidan Lewis; editing by Patrick Markey and Jason Neely)
(Except for the headline, this story has not been edited by NDTV staff and is published from a syndicated feed.)