Pakistan's two dynastic parties announced late Tuesday a power-sharing agreement that is set to return Shehbaz Sharif to the premiership after an election this month failed to produce a decisive winner.
The army-backed Pakistan Muslim League-Nawaz (PML-N) and The Pakistan Peoples Party (PPP) said they had settled days of negotiations on securing a majority to form a coalition government that will also include several smaller parties.
Candidates loyal to jailed former prime minister Imran Khan won the most seats but were forced to stand as independents following a sweeping crackdown on the party.
The PML-N and PPP will put forward former leader Sharif as prime minister and Asif Ali Zardari, the husband of assassinated former prime minister Benazir Bhutto, as president.
"The Pakistan People's Party and Pakistan Muslim League Nawaz have attained the numbers and we will form a government," said PPP chairman Bilawal Bhutto Zardari, the son of Zardari and Bhutto, at a late-night press conference in the capital Islamabad.
"We are hopeful that Shehbaz Sharif will soon become the prime minister of the country and the whole of Pakistan should pray that the government should be successful."
Sharif, seated next to Bhutto, added: "After 76 years, we find ourselves dependent on loans, and overcoming this situation is easier said than done. There are significant challenges that we are facing ... We have to take Pakistan out of these challenges."
Bhutto Zardari said that ministerial portfolios had been agreed and would be announced in the coming days.
The National Assembly must convene for the first time by February 29, when the coalition can be formally approved.
The two parties combined in 2022 to oust former leader Khan in a no-confidence vote before sharing power in a shaky coalition that also saw Sharif at the helm, until the National Assembly was dissolved in August ahead of elections.
His brother, three-time premier Nawaz Sharif, returned to Pakistan from self-imposed exile to lead the election campaign but failed to secure the expected majority despite analysts saying they had the backing of the military, the country's kingmakers.
There were widespread allegations of vote-rigging and result manipulation after authorities switched off the nation's mobile phone network on election day, ostensibly on security grounds, and the count took more than 24 hours.
Former cricketing legend Khan has been languishing in jail since August, slapped with lengthy sentences for corruption, treason and an illegal marriage -- charges he says are politically motivated and designed to keep him from power.
Khan was brought to power in 2018 by a young electorate weary of the dynastic politics of PML-N and PPP, but also reportedly with the blessing of the generals.
He was booted from power after analysts say he fell out with the military and went on to wage a risky campaign of defiance against the establishment.