ISLAMABAD — Pakistani lawmakers elected a ruling party loyalist with a checkered past as prime minister on Friday, restoring government to the country after days of political turmoil.

But the election of Raja Pervaiz Ashraf was unlikely to calm the tensions roiling the country, and many predicted he would face the same fate as his predecessor who was ousted earlier this week.

The drama highlighted the turbulent nature of politics in this nuclear-armed country that is vital to U.S. hopes for ending the war in Afghanistan. The Americans need Pakistan's help in talks with the Taliban and are trying to persuade Islamabad to reopen war supply lines to Afghanistan.

Ashraf was the second choice to replace Yousuf Raza Gilani who was dismissed by the Supreme Court earlier this week for refusing to initiate a corruption investigation against his boss, President Asif Ali Zardari.

The ruling Pakistan People's Party then nominated outgoing textile minister Makhdoom Shahabuddin, but he was hit Thursday by an arrest warrant for his role in a drug import scandal. The warrant was issued by an anti-narcotics force run by the military, which wields political power and has staged three coups in Pakistan's short history.

The PPP and its coalition partners elected Ashraf as prime minister by a vote of 211 to 89. Supporters thumped their hands on their desks in a show of support while PPP members in the balcony chanted "Long Live Bhutto" in homage to the party's founder, Zulfiqar Ali Bhutto.

Speaking to lawmakers after his election, Ashraf said the economy, the power crisis and inflation were his main priorities.

"Our country cannot afford politics of confrontation at this time," he said.

The Gilani government, widely critized as corrupt and inept, has done nothing to fix the country's problems.

Ashraf said he wanted to deal with the U.S. on an equal footing. Speaking in English in an otherwise Urdu-language speech, he also said there would be no peace in Pakistan without peace in Afghanistan.

The government's term was scheduled to end in March 2013, but it was now expected to end sooner because of the pressures on the coalition. A senior PPP member, Khursheed Shah, said earlier Friday that he expected general elections to be held this year.

Ashraf, meanwhile, was expected to face the same demand from the Supreme Court – a panel of activist judges – to act on the corruption case against Zardari.

The case was initially heard by Swiss legal authorities in the 2000s and dates back to allegations that Zardari laundered state money there in the decade before that.

Critics say that by pressing the case, the court is taking on a political role, threatening the democratic process in a country where elected governments have traditionally been squeezed by the army, often in league with a partisan court.

Court supporters say activist judges are needed to keep a check on corruption and government misuse of power. They point out the court has also been carrying out investigations into human rights abuses by the military.

Ashraf was head of the water and power ministry for three years, an unpopular position in a country where daily blackouts in the steamy summer can be as long as 22 hours. Pakistanis ridiculed him for repeatedly claiming the power crisis would be over by "December" only to have conditions get worse the next summer.

He has been accused of corruption relating to power projects. Ashraf oversaw the import of short-term power stations, or "rental power" projects that cost the government millions of dollars but produced little energy. The policy earned him the nickname "Raja Rental" in the Pakistani media and opponents could be heard shouting the nickname Friday in the vast Parliament hall. He denies any wrongdoing, and supporters rallied to his defense.

Politician Rehman Malik said the courts and law enforcement are focused on targeting politicians and not criminals. Malik himself was suspended by the Supreme Court from the parliament over allegations he has dual nationality. He lost his minister of interior post but then was appointed adviser to Gilani.

"The nominated prime minister has got no convictions. There is no case pending against him," he emphasized.

Analysts said the PPP likely chose Ashraf because they knew he wouldn't last long in office.

"He is a cynical choice by the PPP. Whoever takes over as prime minister will be in for a very short time," said Raza Rumi, director of the Islamabad-based Jinnah Institute. "Obviously the PPP will not choose its best for this stint. They will choose people who can be dispensed with."

The political jockeying for power likely means Pakistan's more weighty problems will fall off the agenda until a new government is established. The country's economy is in shambles. The military is fighting a violent insurgency in the tribal areas near the border with Afghanistan. In many parts of the country, residents receive only a few hours of electricity a day.

Pakistan and U.S. relations are also at an all-time low. The U.S. accuses Pakistan of not going after insurgent groups operating in its tribal areas while Pakistan says the U.S. doesn't give it credit for the losses it has suffered fighting al-Qaida and other militants.

Pakistan closed U.S. and NATO supply routes going through Pakistan into Afghanistan after American forces accidentally killed 24 Pakistani troops on the border. Pakistan refuses to open the routes without an American apology.

___

Associated Press writers Chris Brummitt and Zarar Khan contributed to this report.

Earlier on HuffPost: