One of Pakistan’s most important allies endorsed the country’s newly appointed Prime Minister, Raja Pervez Ashraf, on Monday.

As a close and friendly neighbor of Pakistan, we will firmly support its efforts to realize social stability and to boost national development and economic and social progress,” said a spokesman for China’s foreign ministry in Beijing, Hong Lei, during told a regular press briefing.

We are willing to continue strengthening our all-weather partnership with Pakistan.”

Ashraf became Pakistan’s new Prime Minister on Friday, the culmination of a week that might have been unprecedented even for a country that is used to political chaos.

Last Tuesday, the Pakistani Supreme Court dismissed Prime Minister Yousuf Reza Gilani on the basis of a contempt conviction, citing that he was disqualified from holding office over his failure to investigate President Asif Ali Zardari for alleged money laundering charges dating back to the 1990s.

Subsequently, the next Prime Minister nominee proposed by the ruling Pakistan Peoples Party (PPP), Makhdoom Shahabuddin, was ordered arrested by a judge in connection with illegal medical drug imports when he served as health minister (Shahabuddin was Zardari’s first choice as Gilani‘s successor).

This led to the nomination of Ashraf, a former water minister, and apparently Zardari’s back-up choice.

Now, after the parliament in Islamabad approved of Ashraf on Friday, he is, at least for the time being, the new political leader of Pakistan.

China’s Xinhua news agency praised Ashraf for seeking to strengthen relations between the two Asian giants.

“Pakistan's friendship with China is higher than mountains and China has helped us in every hour of need and we would further enhance it,” Ashraf reportedly said during his first speech to Pakistani parliament.

China may now be Pakistan’s most important friend on the planet, given that relations with U.S. have badly deteriorated, while India remains an implacable regional foe.

Ashraf must also deal with neighboring Afghanistan, where after ten years of war, a militant insurgency threatens to spill across the border and raise new security fears for both countries after NATO troops depart by 2014.

Cross-border attacks, including one over the weekend that killed six Pakistani soldiers, are of immediate concern to Islamabad.

“Pakistan has strongly protested with Afghanistan on the cross-border attacks and I will also take up this issue with [President Hamid] Karzai,” Ashraf told reporters in Karachi.

Ashraf also has a multitude of domestic problems to contend with – not least of which are the strained relations between the civilian government and the judiciary and the military (indeed, it is widely suspected that the courts forcibly removed Gilani from office as part of a power play in tandem with the military to undermine the government).

During his meeting with other political parties Ashraf declared that the three pillars of the country – the secular government, the military and the courts – should work within their limits to do what it best for the country.

Given the severe problems Pakistan faces – including rising food prices, frequent power outages, spiraling violent crime, the threat of Islamic militants, etc. – it cannot afford a continuing feud between the various branches of state leadership.

We have taken the oath to protect the constitution and respect judiciary, Ashraf said.

The candle lit by our martyred leaders will continue to illuminate the country.

However, this honeymoon between the government and the judiciary may be short-lived.

The issue that forced out his predecessor – the refusal by Gilani to probe Zardari for alleged corruption – may doom Ashraf as well, if the courts again demand he take such action.

Ashraf himself is also ensnared in legal troubles of his own.

He had been accused of having received kickbacks in rental power projects and using that money to illegally purchase properties in London during his tenure as Pakistan’s water and power minister.

Ashraf is reportedly still under investigation by the National Accountability Bureau, or NAB, the anti-corruption watchdog of the Pakistani government.