Forces loyal to Yemeni President Ali Abdullah Saleh fire in the air to stop tens of thousands of protesters, who are demanding he face trial, approaching his compound.

Tribesmen backing anti-government protesters escort protesters outside the central Yemeni city of Dhamar, during a protest march from the southern city of Taiz to the capital Sanaa (Reuters)

Shots rang out as the activists entered Sanaa chanting "no to immunity", at the climax of a mass march that started days earlier in the southern city of Taiz, said residents.

The protesters in Yemen were referring to a deal granting Saleh immunity from prosecution for his part in a violent crackdown on months of demonstrations against his 33-year rule.

The agreement, crafted by Yemen's wealthier neighbours in the Gulf Cooperation Council (GCC), was designed to ease Saleh out of power and avert civil war.

Under the deal, Saleh has transferred his powers to his deputy. An interim government will prepare the country for an election to replace him in February, and separate pro-Saleh troops from militiamen loyal to tribal leaders and rebel army units in Sanaa and elsewhere.

Protesters, many of them young, chanted "For shame, the blood of the martyrs has been sold for dollars", referring to the immunity deal, which was endorsed by a coalition of opposition parties that are part of the interim government.

Witnesses said troops loyal to Saleh spread out across the entrances of streets leading to his compound to block any attempt by protesters to approach it.

Pro-Saleh troops also used tear gas in an attempt to turn back protesters in the Sabaeen district of the capital, the witnesses said.

Read more: Freeze assets of Yemeni president, says Nobel Prize winner

'Multiple challenges'

Later in the day, marchers retreated and headed towards Change Square, a rallying point for the protests which began in January, they added.

Tanks, troops and armoured vehicles were deployed around the presidential compound.

Protesters want the government to be purged of members of Saleh's family, who still hold key posts in the military and security forces.

The new government faces multiple challenges including resurgent separatist sentiment in the south, formerly a socialist republic that fought a civil war with Saleh's north in 1994 after four turbulent years of formal union.

The region is also home to Islamists who have seized chunks of Abyan province. Ensuing fighting with government troops has sparked mass flight, compounding a humanitarian crisis in a country with about 500,000 internally displaced people.

Top oil exporter Saudi Arabia shares US fears that more instability could embolden al-Qaeda's branch in Yemen.

The transition deal, should it stick, would make Saleh the fourth leader to surrender power after mass protests that have redrawn the political map in North African and the Middle East.