"I have a job to do here and can not and will not let the nation down," said Musharraf when he formally assumed his job as a president.
The pivotal moment of his career came following the 11 September attacks in the US when Washington wooed him to join its "war on terror" after realising it needed Pakistan to succeed in its military campaign against the neighbouring Taliban government and al-Qaida forces.
The 60-year-old lifelong military man agreed to allow the US to use Pakistani land in its war causing a major outcry among many parties in the country mainly the Islamist alliance, the Muttahida Majlis-e-Amal (MMA).
Many denounced him as a traitor but he argued: "The future of 140 million people can not be jeopardised. Even Islamic law provides that if we are faced with two difficulties and we have to select one of them, it is always better to choose the lesser trouble."
Shortly after siding with the US, Musharraf launched a major clampdown on hardliners and armed Islamist dissidents waging a high-profile campaign for what he called "moderate" Islam, both at home and on the world stage.
Relationship with India
After a two-year long hiatus between Pakistan and India, Musharraf held a landmark meeting with Indian Prime Minister Atal Behari Vajpayee in January 2004 seeking to cast aside the enmity that took their nuclear-armed countries to the brink of war in 2002.
The president has sought to maintain the momentum with the new Congress government in Delhi.
The divided territory of Kashmir is the main obstacle to progress between the two countries. It has been divided between the rivals since a war which followed independence in 1947. The bitter dispute has cost tens of thousands of lives.
"The future of 140 million people can not be jeopardised. Even Islamic law provides that if we are faced with two difficulties and we have to select one of them, it is always better to choose the lesser trouble."
General Perevez Musharraf
Since he came to power Musharraf has survived four assassination attempts on his life blamed on armed Islamists.
Two of the attempts occurred in Karachi and the other two in the military capital, Rawalpindi.
His major enemy, al-Qaida, has threatened to assassinate him on a number of occasions and asked the Pakistani tribes to do the same.
Vote of confidence
In January 2004, Musharraf won the vote of confidence in both houses of Pakistan's parliament and four provincial assemblies, keeping him in power until late 2007.
Musharraf handed some powers to a prime minister after elections in October 2002, but remains easily the most powerful man in the country.
Under a deal with the MMA, Musharraf was to have kept the post of military chief until the end of 2004.