Nawaz Sharif has held the job of Pakistan's prime minister twice before, but the last time didn't end so well. The 63-year-old was toppled in a coup by the country's army chief in 1999 and sent into exile in Saudi Arabia. He spent years in the steamy Gulf before brokering his return in 2007.
After serving as the country's main opposition leader, Sharif came roaring back in Saturday's elections, in which his Pakistan Muslim League-N party scored a resounding victory.
Sharif's supporters believe his pro-business background and years of experience in government make him the right person to tackle the country's many economic woes, like growing power cuts, painful inflation and widespread unemployment. He is also a main proponent of improving ties with Pakistan's archenemy and neighbor India, a step that would likely boost his country's economy.
Critics worry that Sharif, who is known to be personally very religious, is soft on Islamic extremism and won't crack down on militants that pose a serious threat to Pakistan and other countries — chief among them the Taliban and al-Qaida-linked groups.
The United States will be watching Sharif closely, since Washington relies on help from Islamabad to fight Islamic militants in Pakistan and to negotiate an end to the war in neighboring Afghanistan.
The son of a wealthy industrialist from central Punjab province, Sharif entered politics as a protege of Gen. Zia ul-Haq, who seized power in a military coup in 1977. Sharif was prime minister from 1990-93 and again from 1997-99.
Sharif's second stint in power was cut short when he was toppled in a military coup and sent into exile by Gen. Pervez Musharraf, who was then serving as army chief. The coup followed an attempt by Sharif to fire Musharraf by preventing his plane from landing when he returned from a trip abroad.
In an ironic twist, Musharraf is currently under house arrest in Pakistan after returning from self-imposed exile, and it will be up to Sharif's government to decide whether to bring treason charges against the former military strongman.
Following the 1999 coup, Sharif spent seven years in exile before Musharraf grudgingly allowed him to return in November 2007, apparently under pressure from Saudi Arabia's king, an important ally of Pakistan.
Former Pakistani Prime Minister Benazir Bhutto also returned from exile around the same time to run for parliament, but she was killed in a gun and suicide bomb attack at the end of 2007, before the election.
Sharif also intended to run in the 2008 election, but he was disqualified by a court because of a conviction on terrorism and hijacking charges, stemming from Musharraf's coup. Sharif insisted the conviction was politically motivated, and it was overturned by the Supreme Court in 2009.
Sharif's party came in second in the 2008 parliamentary election, behind Bhutto's Pakistan People's Party. The two parties originally formed a government together, but after two months, Sharif's party became the main opposition, accusing Bhutto's widower, President Asif Ali Zardari, of reneging on a vow to restore judges fired by Musharraf.
Sharif put steady pressure on the government, but wary of army interference, never enough to threaten its hold on power. This attitude helped enable the national assembly to complete its five-year term and transfer power in democratic elections on Saturday for the first time since the country was founded in 1947.
Sharif draws much of his political support from the middle class in urban areas of Punjab, Pakistan's most populous province, because of his pro-business policies. But he has also played the populist. May of the battered yellow taxis rattling around Pakistani cities date from a microfinance plan he set up to help create jobs for the poor. He also set a minimum wage.
But he is perhaps best known for testing nuclear weapons in response to India's nuclear test in 1998.
It was an immensely popular decision in Pakistan — millions celebrated in the streets — but one that was made in defiance of U.S. appeals for restraint. President Bill Clinton even intervened personally, reportedly offering millions of dollars in aid and a state dinner if Sharif held off.
Sharif's party, which controlled the Punjab government for the last five years, is more closely aligned with hard-line Islamist parties than the outgoing Pakistan People's Party. The Pakistan Muslim League-N has been criticized for not going after militant outfits in Punjab, a stance analysts said was driven by its reliance on banned militant groups to deliver key votes.
During Sharif's tenure as prime minister in the 1990s, he not only supported the Taliban regime in Afghanistan but also tried to vastly increase the powers of his office while pushing aside Pakistan's penal code in favor of an Islamic justice system. Many saw these ill-fated moves as an attempt to "Talibanize" Pakistan, and they eroded his popularity.
After returning from exile, Sharif admitted that the pro-Afghan Taliban policy he pursued when he was prime minister in the 1990s was a failure and said Pakistan should stop trying to influence affairs in Afghanistan. That is the same message the U.S. sent to Pakistani leaders as American troops fought the Taliban in Afghanistan.
Pakistan and the U.S. have had a tense relationship in recent years, especially following the American raid that killed Osama bin Laden in a Pakistani army town in 2011.
Sharif has criticized unpopular U.S. drone attacks targeting al-Qaida and Taliban militants in Pakistan, and has called the Afghan conflict "America's war." The Punjab government, controlled by Sharif's party, turned down over $100 million in American aid in 2011 to protest the bin Laden raid.
Now, many analysts believe Sharif will take a pragmatic view toward relations with the U.S. and won't want to see ties deteriorate.
His influence on the course of the relationship, as well as other foreign policy issues, will be tempered by Pakistan's powerful army, which often plays a dominant role in national security decisions.
Many observers are watching closely to see how Sharif deals with the military in his first months as prime minister.
For example, later this year the term of Pakistan's chief of army staff Gen. Ashfaq Parvez Kayani — the most powerful military officer in the country — is slated to end. The appointment of a new chief could create friction between Sharif and the army's leadership.