Shehbaz Sharif was voted in on Sunday as Pakistan's prime minister for a second time
Shehbaz Sharif was voted in on Sunday as Pakistan's prime minister for a second time AFP

Shehbaz Sharif was voted in on Sunday as Pakistan's prime minister for a second time, presiding over a shaky alliance that has shut out followers of jailed opposition leader Imran Khan.

Newly sworn-in lawmakers in Pakistan's National Assembly elected Sharif by 201 votes, three weeks after national elections marred by widespread allegations of rigging.

"Shehbaz Sharif has been declared to have been elected as prime minister of the Islamic Republic of Pakistan," said newly appointed speaker of the National Assembly Sardar Ayaz Sadiq.

Omar Ayub Khan stood against Sharif as the candidate of choice for MPs loyal to Khan, gaining 92 votes.

The Sharif family's Pakistan Muslim League-Nawaz (PML-N) party allied with their historic rivals the Pakistan Peoples Party (PPP), as well as several smaller factions, to keep Khan's candidates out.

In return, the PPP -- a dynastic party ruled by the family of slain ex-premier Benazir Bhutto -- have been promised the office of president for Bhutto's widower, Asif Ali Zardari.

Ex-prime minister Khan was jailed in the run-up to the February 8 polls and barred from contesting, while his Pakistan Tehreek-e-Insaf (PTI) party was targeted by a crackdown of arrests and censorship.

PTI candidates were forced to run as independents, but nonetheless secured more seats than any other party.

They fell short, however, of the figures needed to form a government, paving the way for Sharif's return.

Sharif, 72, first served as prime minister in 2022 at the head of a strikingly similar alliance which ousted ex-cricket star Khan.

Much like during his first tenure, Sharif will face an overlapping trio of crises plaguing the nation of more than 240 million.

Pakistan came to the brink of economic default during his first term, before a last-minute International Monetary Fund (IMF) deal saved the day.

Inflation remains sky-high and Sharif will be the face of unpopular belt-tightening measures likely demanded by the international lender for a new deal needed in the coming months.

Security has also deteriorated, with Islamabad blaming a spike in attacks on the Taliban group's return to power in neighbouring Afghanistan in 2021.

Analysts warn of a legitimacy crisis, with PTI claiming they were robbed of a majority by rigging on polling day when mobile internet was shut down and results were massively delayed.

Pakistan's powerful military establishment has loomed large over the election, throwing its weight behind PML-N and targeting the charismatic Khan and his followers with a crackdown.

While PML-N has found itself back at the helm in Islamabad, the fact it has had to broker a broad alliance to rule has badly bruised its reputation.

Shehbaz's brother and three-time prime minister Nawaz Sharif had been tipped to lead when PML-N expected a better showing from the elections.

But Shehbaz -- considered the more pragmatic mediator, a softer personality, and the military's favourite -- stepped into the role after the result was not what they hoped for.