A media mogul, Karoui was detained in August before the first round of the election and has spent the entire campaign period in prison pending a verdict in his trial for money laundering and tax evasion, which he denies.
“The appeals court has decided to immediately free Nabil Karoui,” his lawyer Kamal Ben Massoud told Reuters without elaborating.
“His release saved our transition and the situation at the last moment … We were in a very difficult moment in Tunisia which really threatened Tunisian democracy,” Karoui’s spokesman Hatem Mliki said.
Al Jazeera correspondent Hashem Ahelbarra reporting from Tunis said Karoui’s supporters had gathered outside the party headquarters after the announcement of his release and “went in convoys to the jail to greet their leader”.
“This comes as a huge surprise,” Ahelbarra said.
“Just the request for his release was denied many times …This will make huge political changes here in Tunisia”, he added.
Ahelbarra said that “we will have to see” if his release will build up more momentum in advance of Sunday’s election.
“What is most certain is that you will definitely see more people coming to the vote in Tunisia”, he added.
Last week, interim president Mohamed Ennaceur said Karoui’s detention and inability to campaign had damaged the credibility of the election.
The case against Karoui was brought three years ago by I Watch, the local chapter of Transparency International, an anti-corruption watchdog.
His party, Qalb Tounes, claim that his arrest weeks before the presidential vote was politically motivated – an attempt by the government to eliminate political opponents.
It is not clear when a final verdict will be made in the case.
Denied equal opportunity
Election watchdogs had also called for Karoui’s release saying there could be no fair vote if he was detained.
Tunisia’s electoral commission had itself warned that Karoui could appeal against the result if he loses as he had been denied equal opportunity to communicate with voters, and that the result could be annulled.
Karoui took 15.6 percent of the vote in the first round of the election three weeks ago and on Sunday he will face Kais Saied, a retired law professor who came first with 18.4 percent.
Tunisia’s presidential election on Sunday is the second since the 2011 revolution that toppled longtime leader Zine El Abidine Ben Ali.