The Prime Minister of Pakistan has hailed China as his country’s “best friend” amidst deteriorating relations with the United States.

Yousuf Raza Gilani has arrived in Shanghai for a four-day visit to celebrate diplomatic ties and, perhaps, to suggest to Washington that Pakistan can rely on China as a source of economic and military aid.

He recently met with US Senator John Kerry in an effort to soother tattered relations between the US and Islamabad. It is unclear if any progress on that front was made since Kerry reportedly took a strident tone in demanding that Pakistan do a better job in stamping out terrorism.

“We are proud to have China as our best and most trusted friend,” Gilani said, according to China’s official news agency, Xinhua.

“China will always find Pakistan standing beside it at all times. We appreciate that in all difficult circumstances, China stood with Pakistan. Therefore we call China a true friend and a time-tested and all-weather friend,”

Pakistani officials remain embarrassed and angered over the killing of Osama bin Laden in a Pakistani compound by US Special Forces that was conducted (allegedly) without the knowledge or cooperation of Islamabad.

China has officially condemned the commando raid by the U.S. as a violation of Pakistani sovereignty and has expressed its support for Pakistan’s beleaguered government.

Gilani is expected to meet with a slew of senior Chinese officials, including Premier Wen Jiabao, President Hu Jintao and prominent economic figures. The Pakistani Prime Minister is also expected to sign a number of economic accords with Beijing.

China has provided Pakistan with two new civilian nuclear reactors (to compensate for a similar pact between India and the U.S.), and also remains the country’s principal weapons supplier.

As India’s relations with the U.S. appear to have improved, Pakistan may seek closer ties with China.

In fact, Kerry recently underscored the American’s dissatisfaction with Pakistan when he told a foreign relations committee: “Ultimately, the Pakistani people will decide what kind of country Pakistan becomes, whether it is a haven for extremists or the tolerant democracy that [Pakistani founder] Muhammad Ali Jinnah envisioned 64 years ago.”

However, there are great doubts that Beijing wants to get too closely involved with a country with as many problems as Pakistan.