Pakistan's national and four provincial parliaments have voted to make Pervez Musharraf head of state with a five-year term.
The general declared himself president in 2001, having seized power in an army coup two years earlier, but the move lacked any constitutional backing.
The constitution was amended this week to enable him to be made "elected" head of state if he won 50% of the vote.
Opposition parties walked out, denouncing the proceedings as a sham.
The lower house of parliament and the assemblies of the North West Frontier Province, Baluchistan, Punjab and Sindh all voted unanimously in favour of General Musharraf, with scores of opposition lawmakers boycotting the vote.
The result in the Senate was 56-1.
Pakistan's main Islamist parties abstained after reaching a surprise deal with General Musharraf allowing him to complete his five-year presidency in 2007.
**Protracted struggle***
The BBC's Zaffar Abbas says it is yet another bizarre event in Pakistan's chequered political history - a military ruler seeking acceptance as constitutional head of the state, not through elections but through votes of confidence.
However, analysts say the move marks an end of a protracted struggle between the president and parliament over how much power he should have.
The package of constitutional changes were approved by the two houses of parliament earlier this week.
Ahsan Iqbal, the chief co-ordinator of the opposition Pakistan Muslim League party of former Prime Minister Nawaz Sharif called it a "mockery of democracy" in remarks quoted by the Associated Press.
"Musharraf has staged another drama to get his illegal presidency validated. It is a total fraud. We don't accept these results; we do not accept him as president," he said.
Parliamentary business has been paralysed by protests since General Musharraf assumed wide-ranging powers in 2002.
Legislators have disrupted proceedings by banging their desks, interrupting speakers and walking out of proceedings.
The amended constitution allows the president to dissolve parliament and to dismiss the prime minister with the approval of the Supreme Court.
**Chief justice replaced***
As part of the package of measures that took effect on Wednesday, President Musharraf appointed a new chief justice to oversee the Supreme Court.
He has picked Nazim Hussain Siddiqui - a senior Supreme Court judge - for the post.
In 2000, Justice Siddiqui was one of a panel of Supreme Court judges who ruled against opposition leaders when they challenged the bloodless coup that had brought General Musharraf to power.
Two other Supreme Court judges have questioned Justice Siddiqui's appointment, claiming they were senior to him and ought to have been considered for the job.
Under the agreement between the president the Muslim coalition, the MMA, it was agreed that General Musharraf would stay on as president until 2007, but would step down as head of the army by the end of 2004.
**PHOTO CAPTION***
Pervez Musharraf.