In this photograph taken on September 27, 2007, leaders of Pakistani self-exiled former premier Benazir Bhutto's Pakistan People's Party Babar Awan, right), and Raja Pervez Ashraf, center, arrive at the election commission office to file nomination papers for the forthcoming presidential election in Islamabad. (Aamir Qureshi/AFP/Getty Images)

Pakistan has a new prime minister — a former energy chief, Raja Pervez Ashraf — but the Parliament’s choice Friday could set up yet another clash between the country’s activist judiciary and its fragile civilian government.

Ashraf, who was minister for power and water from 2008 to 2011, is implicated in a corruption case that the Supreme Court says involved bribes and contract irregularities when private companies were allowed to set up small energy production plants while he was in office. The ruling Pakistan People’s Party picked him to replace the longest-serving premier in Pakistan’s history, Yousuf Raza Gilani, who was dismissed by the court Tuesday for contempt of court.

Ashraf, 61, is a longtime party loyalist and friend of President Asif Ali Zardari, who turned to Ashraf after an anti-narcotics court issued a warrant for the arrest of his first choice for premier.

The public has frequently blamed Ashraf for a persistent energy crisis that has crippled the country with blackouts, water shortages and steep increases in the price of fuel. Amid scorching summer temperatures, rioters routinely take to the streets to demand electrical service, which has been curtailed in some areas to just an hour a day.

“This is a terrible signal to the people of this country,” Najam Sethi, one of Pakistan’s most influential journalists, said of Ashraf’s ascension. “To task the same man who failed to solve the energy crisis is dubious and ironic. It will not go down well with the media and the public.”

The Supreme Court, led by its crusading chief justice, Iftikhar Mohammed Chaudhry, in March shut down the “rental power projects” that the government had authorized, beginning in 2006 under then-President Pervez Musharraf.

The program was a failure in terms of energy production, and Ashraf — who had pledged to end rolling blackouts within a year — earned a derisive nickname: “Rental Raja.”

Officials overseeing the rental power projects were “involved in corruption and corrupt practices” that cost Pakistan millions, the Supreme Court said, and it demanded an investigation. Those responsible, allegedly including Ashraf, are “liable both for civil and criminal action,” Chaudhry said in his ruling.

Ashraf has denied any wrongdoing, but Chaudhry is persistent in following up his rulings and ordering officials into court.

Gilani’s ouster was rooted in the chief justice’s insistence that the prime minister reopen an old money-laundering case against the president. Gilani’s refusal prompted the contempt conviction that disqualified him from office.

The public often hails Chaudhry as a hero for taking on corruption, but Gilani’s removal has also sparked criticism that the judge is bent on destabilizing the government and opening the door for a military coup.

Ashraf is expected to be a short-term, place-holder prime minister, with parliamentary elections now likely to be held before year’s end, rather than in March as scheduled.

U.S. officials had no immediate reaction to Ashraf’s selection, but he will inherit a severely strained relationship with Washington. Most notably, the political upheaval here has contributed to Islamabad’s failure to approve a deal with the United States that would reopen NATO supply routes to Afghanistan via Pakistan. Thousands of container trucks and oil tankers have been barred from two border crossings for more than seven months, costing the United States an estimated $100 million a month.

Ashraf was sworn in Friday evening after his election by the National Assembly, the lower house of Parliament, where he secured 211 votes against 89 for a candidate from the opposition party of former prime minister Nawaz Sharif.

Special correspondent Shaiq Hussain contributed to this report.