Dozens of people were killed in Tunisia Saturday as riots gripped the North African nation 24 hours after the country's president was forced to flee after 23 years of iron-fisted rule.

Sporadic gunfire could be heard around Tunis, the capital, during the second day of intense violence following the ouster of President Zine El Abidine Ben Ali. Ben Ali managed to hold on to power throughout a month of anti-government protests, but abruptly fled Friday for Saudi Arabia, leaving a power vacuum that was filled twice in 24 hours.

Hours after Ben Ali fled, Prime Minister Mohammed Ghannouchi assumed power. But on Saturday, the former president of the lower house of parliament, Fouad Mebazaa, was sworn in as interim president on authority of the Constitutional Council. Mebazaa has been given 60 days to organize an election.

In a televised address shortly after he was sworn into office, Mebazaa called for the formation of a "national unity government in the country's best interests," and said all political parties will be consulted "without exception or exclusion."

Amid the presidential musical chairs, mass rioting led to looting as shops throughout the capital remained shuttered Saturday. Protesters engaged soldiers outside the Interior Ministry offices, where two bodies could be seen on the ground. Another group of demonstrators set fire to the capital's main train station.

Protests over government corruption, lack of jobs and restrictions on civil liberties had been largely peaceful for the last month, but exploded into violence with Ben Ali's ouster on Friday.

On Saturday, a fire at a prison in the coastal resort town of Monastir killed 42 people, officials said. Down the coast in Mahdia, a rebellion at a prison left five inmates dead after soldiers opened fire. A prison official, who spoke on condition of anonymity, said the rest of the prisoners were freed to avoid further bloodshed.

Back near the capital, residents of outlying neighbourhoods reported being attacked in their homes by assailants wielding weapons.

"This isn't good at all. I'm very afraid for the kids and myself," mother of three Lilia Ben Romdhan told public television station TV7. "If (he) had stayed in the country it would be better."

The unrest caused chaos for tourists rushing to leave the country. While Tunisian airspace reopened Saturday, some flights were cancelled or delayed, hampering evacuation efforts.

Meanwhile, Saudi Arabian officials confirmed Saturday that Ben Ali and some of his family members had arrived in the kingdom, saying it welcomed the former leader with a wish for "peace and security to return to the people of Tunisia."

A seamless transition to new power is anything but certain. Ben Ali has ruled Tunisia autocratically for more than 20 years, giving allies positions of power within his government and exiling or jailing opponents.

Ben Ali, 74, took power in a bloodless coup in 1987, and consistently won national elections with dubious vote counts. In 2009, he was elected for his fifth term with 89 per cent of the vote.

While Tunisians enjoy a better quality of life than residents in nearby Algeria or Libya, unemployment has been high at 14 per cent, a figure widely believed to be much higher among young adults.

The rioting exploded after a young fruit seller, who had trouble finding work despite a university education, committed suicide in December when police confiscated his produce, which he was selling without a permit.

With files from The Associated Press