Karoui's release was the latest saga in a topsy-turvy electoral season in this North African country trying to make its budding democracy flourish. As legislative election results were announced late Wednesday, three days after the voting, it became clear that Tunisian politics would be put to the test.
Karoui's secular Qalb Tounes, or Heart of Tunisia party, looked destined to face off in parliament with its political enemy, the conservative Islamist party Ennahdha.
The Islamist party finished first in Sunday's parliamentary elections by winning 52 seats, while Heart of Tunisia took 38 seats, the electoral board announced late Wednesday.
The top party, Ennahdha, gets to designate the prime minister. But with 217 seats in the Assembly of People's Representatives, both parties are far from a majority. That puts the nation that kicked off the Arab Spring uprisings in 2011 and the only country to emerge with a democracy on a fractious political path.
The jailing and last-minute release of Karoui, 56, underscored Tunisia's bizarre electoral season, which saw two upstart candidates reach the runoff in the presidential election and more than 200 parties in the legislative races sandwiched between the two rounds of the presidential vote.
Kais Saied, 61, a law professor who is pitted against in Karoui in the presidential runoff, has no party at all.
Karoui's brother, Ghazi Karoui, who was wanted by judicial authorities but fled, won a parliamentary seat in the Bizerte region.
Turnout for Sunday's legislative elections was lower than in past elections, but the stakes are high. The legislature oversees social and economic issues that are paramount as Tunisia struggles against joblessness and a flagging economy - amid a continuing battle against Islamist extremists and the threat of terrorist attacks.
A small crowd of joyous supporters welcomed Karoui with honking horns, shrieks of joy and small fireworks as he left a prison outside Tunis. He made no formal statement as he left, but was expected to hold a news conference.
Karoui, owner of the private Nessma TV station, was arrested Aug. 23 for investigation for alleged money laundering and tax fraud. He has said the allegations against him amount to a politically motivated smear campaign, but was allowed to run for president because he has not been convicted.
Karoui had been pressing to be set free so he could campaign on an equal footing with his rival for the runoff vote. Saied, in turn, had said he wouldn't campaign as long as his rival was in jail.
The Court of Cassation, the country's highest court, overruled a lower court earlier Wednesday and ordered Karoui freed.
The head of Tunisia's independent electoral commission praised the release.
"Our point of view was very clear since the beginning. There was no equality of opportunity as one of the candidates was not present and arrested," commission chief Nabil Bafoun said.
"There are 48 hours ahead of us. It's not much, but we still have a chance to let them (the two presidential candidates) campaign."
Karoui's party calls itself "modernist" but has campaigned in Tunisia's poor heartland, drumming up voters among the have-nots.
Saied, whose sober-looking face gained him the nicknamed "robocop," wants to revamp the system to decentralize the power structure with an emphasis on politics at a local level.
Tunisia has held its presidential election early following the July death in office of President Beji Caid Essebsi. Karoui and Saied are political novices but beat out a crowded field of contenders in the first round of voting.
This story has been corrected to show the presidential candidate's name is spelled Karoui.
Associated Press journalist Mehdi El Arem in Tunis contributed to this report.
Copyright 2019 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.