His supporters dominate the assemblies, thanks to elections five years ago which were widely condemned as rigged.

Chief Election Commissioner Qazi Muhammad Farooq told the National Assembly that Gen Musharraf had won 252 of 257 votes cast in the upper and lower houses.

He said his nearest rival, Wajihuddin Ahmed, had won just two votes. Three votes had been rejected.

There was a similar picture in the assemblies in the provinces of Punjab, Sindh, North West Frontier and Balochistan.

Ruling party members claimed victory even before counting had begun, calling it a step on the way to "full democracy".

The opposition said the constitution had been flouted.

"We will not accept him as president... He is a person who has hardly any respect for the rule of law," Sadique ul-Farooq, a leader of the party of exiled former Prime Minister Nawaz Sharif told the Associated Press news agency.

Security was tight in cities across Pakistan, after opposition parties and lawyers' groups called for protests.

In Peshawar in the north-west police fired tear gas at lawyers protesting near the provincial assembly building.

'Just a formality'

Pakistan has been engulfed in political upheaval in recent months, at the same time as the security forces have suffered a series of blows from pro-Taleban militants opposed to Gen Musharraf's support for the US-led "war on terror".