Pervez Musharraf, who has died in Dubai aged 79, ruled Pakistan as president from 2001 to 2008 after taking power in a coup, leaving behind a mixed legacy as a leader.
His rule was marked by frequent oppression and human rights abuses, especially as it drew to an end.
However, he also promoted social liberalism under what he termed an "enlightened moderation program," which envisaged a society based on a non-fundamentalist interpretation of Islam. On the economic front, his presidency coincided with a rise in overall gross domestic product by around 50%.
Born in New Delhi four years before Pakistan and India gained their independence from British colonial rule in August 1947, Musharraf lived and went to school in Turkey as a child before returning to Pakistan in 1956.
He was commissioned as a trainee officer in the Pakistani army in 1961. Later, the young Musharraf rapidly climbed the ranks of the military and also fought in two wars against neighboring India in 1965 and 1971.
Acts of violence
He was promoted to four-star general by then-Prime Minister Nawaz Sharif in 1998, making him the serving chief of the army staff. He was in charge of the Kargil infiltration that led to a war between India and Pakistan in 1999.
It was also in this capacity as leader of Pakistan's armed forces that he staged a bloodless coup against Sharif in 1999 after Sharif tried to remove him from his position after months of contention.
This enabled Musharraf to become president of the country in 2001.
As a military dictator trying to assist the US in its "war on terror," especially in Afghanistan, and fighting an ever-increasing amount of criticism at home because of his policies, Musharraf survived at least three attempts on his life during his seven-year rule. These were attacks planned by Pakistan's Taliban militants.
The biggest failed attempt to assassinate him was on December 14, 2003. This was a bomb attack that targeted his high-security convoy while it was crossing a bridge in Rawalpindi.
It was during Musharraf's rule that attacks from local Taliban groups began to increase in Pakistan. The special forces' operation against religious extremists holed up in the Red Mosque in Islamabad was also carried out in 2007. Musharraf was hugely criticized for the incident, in which over 150 people died.
Benazir Bhutto, Pakistan's former prime minister and leader of the opposition's Pakistan People's Party, was also murdered in 2007 at the end of an election rally in Rawalpindi during Musharraf's rule.
Musharraf had always said that he wanted to change Pakistan, to make it a peaceful, developed and prosperous nation. And while in power, he did what he felt he had to, though not always with unanimous support. Pakistan did change a lot — during his rule and also afterward. But it was not the way he had intended and perhaps not the way the majority of the over 220 million Pakistanis wanted, either.
Musharraf, as president of Pakistan, also had huge differences with the judiciary. He suspended Chief Justice Iftikhar Chaudhry from office after the Pakistan Supreme Court had wanted to examine the legality of Musharraf's reelection as president in October 2007.
Musharraf's political career took a turn for the worse when on August 7, 2008, his rival and ex-Prime Minister Nawaz Sharif and Benazir Bhutto's widower Asif Zardari announced a plan to impeach him.
Eleven days after that, Musharraf announced his resignation as president and was promised permission to leave the country, allowing him to emigrate to London.
When he returned to Pakistan at the end of March 2013, he did so as the head of his new political party, the All Pakistan Muslim League, and with a plan: to return to power through public support.
The crowd of people welcoming him back in Karachi was, however, smaller than he had anticipated.
Upon his return, he said he wanted to free Pakistan from terrorism and that he was risking his life: the Taliban had threatened to kill him upon his arrival.
In the end, however, he was disqualified from taking part in that year's general election after arrest warrants were issued for him and former Prime Minister Shaukat Aziz over their alleged involvement in the killings of Pakistani politician Nawab Akbar Bugti and of Benazir Bhutto.
Sharif, who was reelected as prime minister at the election, then initiated high treason charges against Musharraf for implementing emergency rule and suspending the constitution in 2007.
Musharraf moved to Dubai in the United Arab Emirates in 2016, leading to his being declared an "absconder" in the Bhutto assassination case. He was then sentenced to death in absentia on the treason charges, though that sentence was later lifted by the Lahore High Court.
He died in Dubai on February 5 after suffering from a prolonged case of amyloidosis.