Saif al-Islam Gaddafi, the son of Libya's former leader, has been reinstated as a presidential candidate by a court in Sebha.
Gaddafi's lawyer Khaled al-Zaydi confirmed on Thursday that his client's appeal had been accepted and called the court's decision "a victory for justice and the people's will."
A photo of the smiling candidate was posted on Gaddafi's campaign page on Twitter, along with words of gratitude to God.
This was followed by a video showing Gaddafi's supporters. "Liberals celebrate the return of Dr. Saif Al-Islam to the elections," reads the accompanying text.
Gaddafi was disqualified by the country's election commission because of his 2015 conviction in absentia for war crimes. Sentenced to death by a Tripoli court, he maintains his innocence. He also has a pending arrest warrant issued by the International Criminal Court (ICC). The lodging of his appeal was met with obstacles, including an attack on the court by gunmen, later described by the government in Tripoli as "a group of outlaws."
The election in Libya is set to take place on December 24, with the full list of candidates due to be released in the coming days.
Gaddafi has pledged to "restore the lost unity" of the country, which was plunged into a civil war after the overthrowing and brutal murder of Muammar Gaddafi by NATO-backed rebels in 2011.
Saif al-Islam Gaddafi faces tough competition in his presidential bid, in the form of military commander Khalifa Haftar, the de facto leader of Eastern Libya.