Profile: Nawaz Sharif
Ousted in a 1999 military coup, Nawaz Sharif is Pakistan's prime minister for a record third term after staging a triumphant comeback in parliamentary elections.
Mr Sharif, 63, was jailed and then exiled after the coup, but returned before elections in 2008, since when he has patiently bided his time in opposition.
Tipped to win this year's elections, he has surprised many by the scale of his victory. He also saw off a spirited challenge from the revitalised party of Imran Khan in politically crucial Punjab province.
Nawaz Sharif has been one of his country's leading politicians for much of the last 30 years. Like many of his contemporaries he has survived sustained corruption allegations against him during that time.
President of the Pakistan Muslim League-N (PML-N) and owner of Ittefaq Group, a leading steel mill conglomerate, he is among the country's wealthiest industrialists.
A protege of military leader Gen Zia ul-Haq - who ruled Pakistan from 1977 to 1988 - Mr Sharif is perhaps best known outside Pakistan for ordering the country's first nuclear tests in 1998.
In recent years he has been critical of US policy in Afghanistan and Pakistan and denies being soft on militants. He will now need to try to keep the international community onside to win help with Pakistan's balance of payments crisis.
Mr Sharif is seen as pro-business, with an experienced team who face the task of dealing with a flailing economy, chronic power shortages and Pakistan's security crisis, as well as endemic corruption.
The BBC's Mike Wooldridge in Islamabad says he will have a honeymoon period of sorts - but time will not be on his side.
Nawaz Sharif served as prime minister from November 1990 to July 1993 and from February 1997 until he was toppled in the bloodless October 1999 coup.
He was born into the family of a prominent Lahore industrialist in 1949 and made his mark in politics representing an urban constituency.
He first came to national prominence during the early days of Gen Zia's martial law, serving as Punjab province's finance and then chief minister from 1985-1990.
Observers recall a not particularly impressive political figure, who nonetheless proved himself an adept administrator. He became prime minister in 1990, but was dismissed in 1993, clearing the way for the then opposition leader, Benazir Bhutto, to form a government.
After becoming prime minister again in 1997 with a comfortable majority, Mr Sharif appeared to dominate the political landscape and exerted a powerful hold over all the country's major institutions - apart from the army.
Frustrated by opposition in the parliament, he tried to pass a constitutional amendment that would have enabled him to enforce Sharia law. He also confronted other power centres - a mob of his supporters ransacked the Supreme Court and he tried to rein in Pakistan's powerful military.
Mr Sharif's overthrow by Gen Musharraf showed how dangerous it was for any politician to attempt to curtail the military's influence.
Mr Sharif was arrested, jailed and eventually sentenced to life imprisonment on charges of hijacking and terrorism. He was also convicted of corruption and banned for life from political activities.
But an alleged deal, brokered by the Saudis, saved him and other family members from being put behind bars. Mr Sharif, along with 40 members of his family, were exiled to Saudi Arabia for what was supposed to be a period of 10 years. His years in the political wilderness lasted until his triumphal return to Pakistan in 2007 following a deal with the military.
Owen Bennett-Jones, BBC Islamabad correspondent at the time, recalls that when Mr Sharif was removed from power, many Pakistanis expressed great relief, describing him as corrupt, incompetent and power-hungry.
By overlooking that history and giving him such a strong mandate in the 2013 elections, Pakistanis have expressed their confidence that Mr Sharif is now an older and wiser politician, our correspondent says.
Nawaz Sharif's removal from active politics and banishment to Saudi Arabia also led to serious differences emerging within his Pakistan Muslim League (PML) party.
During his time in exile, some of Mr Sharif's erstwhile party loyalists announced support for Gen Musharraf. But the former prime minister soundly defeated them in the 2008 elections.
The victory was bitter-sweet, however, as the Pakistan People's Party (PPP) won most seats in the vote and Mr Sharif stayed in opposition.
The following year another challenge emerged. Mr Sharif and his brother Shahbaz, who was Punjab chief minister, were declared ineligible to stand for public office by the Supreme Court.
Mr Sharif described the move as a betrayal by President Asif Zardari, who he accused of ordering the ruling after the pair had worked together to remove President Musharraf.
Mr Sharif not only succeeded in getting this order reversed, but was also successful in getting President Zardari to reinstate judges sacked by President Musharraf shortly before he lost power who were thought to be sympathetic to the PML-N.
In the 2013 elections the PML-N faced a strong challenge from former cricketer Imran Khan's Pakistan Tehreek-e-Insaf (PTI) party, which in recent years has held huge rallies in Mr Sharif's Punjab stronghold.
The PML-N sought to counter the threat by using its control of Punjab - home to 60% of Pakistanis - to push through eye-catching schemes including giving away laptops to students and by improving transport in Lahore.
Ahead of the elections Mr Sharif promised to turn Pakistan into an "Asian tiger", with new infrastructure and a government with "zero tolerance for corruption".
"Our political philosophy revolves around economic progress," the two-time former prime minister said. "If a country is economically strong, it is able to solve all the problems, whether law and order or political extremism."
But this wily politician has been around long enough to know that in Pakistan there is a big difference between what is said and what is done.