Supporters of Imran Khan, head of the Pakistan Tehrik-e-Insaf party, celebrate as the national assembly (lower house of parliament) elects the former cricket legend prime minister in Karachi, Pakistan. Picture: Shahzaib Akber/EPA-EFE

Pakistani lawmakers elected former cricket legend Imran Khan prime minister on Friday, paving the way for him to form a coalition government whose first major task will be to avert a brewing economic crisis.

Khan, 65, saw his party sweep to victory in a July 25 general election promising to fight corruption and lift millions of people out of poverty.

Pakistan has been plagued by boom-and-bust cycles and military coups since independence in 1947, as well as by militant violence in more recent years.

Khan, a firebrand nationalist, has promised to create millions of jobs and build world-class hospital and school systems in the mainly Muslim country of 208 million people.

Among his first challenges will be to decide whether to request an International Monetary Fund bailout to ease currency pressures, or seek support from China and risk deepening Pakistan’s economic dependence on its neighbour.

“Imran Khan got 176 votes,” Asad Qaiser, the parliament speaker, said in confirming Khan’s victory over rival candidate, Shehbaz Sharif of Pakistan Muslim League-Nawaz, who garnered 96 votes.

In a sign of the bitter political divisions roiling Pakistan, opposition lawmakers surrounded Khan and shouted “thief, thief Imran Khan” after he was elected premier.

Khan’s Pakistan Tehreek-e-Insaf party holds 151 seats in the 342-seat lower chamber of parliament, short of a majority, but is expected to form a coalition government with smaller parties.

Khan, who will be sworn-in today, has yet to announce his cabinet.

His success in the election ended decades of political dominance by two dynastic powerhouses, the Pakistan Muslim League-Nawaz of three-time premier Nawaz Sharif, and the Pakistan Peoples Party, founded and led by the Bhutto family.

But Khan will face a battle to push through his ambitious reforms and legislative agenda due to the thin majority in the national assembly. The senate, parliament’s upper chamber, is controlled by the opposition.