A statement from the Abu Bakr al-Siddiq Battalion, a militia which controls Zintan, a mountainous region southwest of the capital Tripoli, said Saif al-Islam was released late on Saturday.
The most prominent of Gaddafi’s sons, Saif al-Islam, 44, was captured in Zintan in November 2011 as he was fleeing to neighbouring Niger after opposition fighters seized Tripoli.
Saif al-Islam, the most prominent of Gaddafi’s eight children, was sentenced to death in July 2015 by a court in Tripoli in a mass trial of former Gaddafi government officials.
He is wanted by the International Criminal Court on charges of war crimes and crimes against humanity.
Since the Gaddafi’s four-decade rule ended in 2011, Libya has struggled to establish basic institutions and rule of law, with militias and former fighters challenging the authority of the weak central government.