Tunisian Prime Minister Mohamed Ghannouchi resigned on Sunday after violent protests over his ties to the North African state's toppled former leader, triggering street celebrations in central Tunis.

Analysts said the move could add legitimacy to an election to replace President Zine al-Abidine Ben Ali, ousted on January 14, but could also encourage further opposition demands.

Police fired shots in the air and used tear gas to disperse hundreds of youths breaking shop windows in a commercial district of Tunis shortly after the announcement, while thousands gathered near parliament to celebrate.

We're very happy, but it is not enough, said one of the cheering crowd, who identified himself as Ahmed. We want to see nothing more of this government.

Critics have accused Ghannouchi of being too close to former ruler Ben Ali, toppled after a series of protests that sent shockwaves across the rest of North Africa and the Arab world and encouraged a similar uprising in Egypt.

He was replaced by Beji Caid Sebsi, a former foreign minister under independence President Habib Bourguiba, according to an announcement by interim President Fouad Mebazza.

My resignation will provide a better atmosphere for the new era, Ghannouchi said, adding he wanted to prevent more deaths. Five people have been killed since Friday in clashes between security forces and demonstrators at protests against Ghannouchi, according to the government.

My resignation is in the service of the country, he said during a speech on state TV. I am not a man of repression.

Ghannouchi restated the government's pledge to hold elections to replace Ben Ali, widely seen by Tunisians as repressive and corrupt, by July 15.

RISK OF BACKFIRE

Analysts said Ghannouchi's resignation had the potential to ease street tensions, but may also backfire.

The hope is that, with this concession, street protests will calm down and this will allow the government to get to the task of preparing elections, said Kamran Bokhari of political risk consultancy Stratfor.

But the risk is that it will embolden the opposition forces to demand more concessions.

A Reuters witness said Tunisian soldiers had barricaded a commercial district of Tunis where youths were breaking windows and throwing stones. They fired tear gas and rounds in the air to disperse them. There was no sign of any wounded.

An official at Tunisia's powerful umbrella union UGTT, which has been demanding labour reforms since Ben Ali's removal, said Ghannouchi's resignation was a step in the right direction.

A spokesman for Tunisia's main Islamist group, Ennahda, said the move could pave the way to broader participation in the interim government. Ennahda, banned for two decades under Ben Ali's rule, had complained of being shut out of the caretaker government run by Ghannouchi.