Chinese Premier Wen Jiabao will aim to reassure Pakistan on a visit beginning on Friday that energy, military and economic ties remain tight, despite China's warming relations with India.
Wen, who flies in after a two-day visit to India, is expected to sign off on trade deals officials estimated at between $10 billion and $14 billion with impoverished Pakistan, and is likely to pledge Chinese help to develop a strategic port.
Ties between nuclear-armed rivals India and Pakistan remain tense over a host of issues, and China's ties with Pakistan irk India.
Wen used more than $16 billion in trade deals and promises of political support to charm India into temporarily setting aside disputes with China.
He will want to assure old friend Pakistan that China's improving ties with India do not come at Pakistan's expense.
"China still looks at Pakistan and India through the same lens," said Hamayoun Khan, an independent analyst and former China-Pakistan expert at the Institute of Strategic Studies.
"Whereas the US considers Pakistan as part of Af-Pak and India as a separate country, which is not taken well in Pakistan."
According to a Pew survey of Pakistan public opinion last year, 84 percent of respondents said they had a favorable few of China, and 16 percent had a favorable view of the United States.
Ties that bind
Pakistani diplomats like to refer to China as an "all-weather friend", whose needs -- strategic and economic -- fit in with what Pakistan wants and has to offer.
"It's a question of where each country finds itself and gets the most out of the other," said Talat Masood, an independent defence analyst.
While China is India's largest trade partner, it invests seven times more in Pakistan and is helping it build nuclear reactors, despite grave misgivings in the West.
China wants to use Pakistan as a gateway to the Muslim world and as a new Silk Road for China's energy-hungry interior, as well as a balance against India's military rise.
Pakistan, in turn, plans to further rely on China for the bulk of its weapon systems, as a major investor for its ports and roads, and as a counter-weight to American demands and conditions in the fight against Islamist militancy.
Wen is expected to spend almost exactly the same amount of time in Islamabad that he did in New Delhi.
A key topic will be Pakistan's deep-water, strategic Gwadar port, on the Arabian Sea coast, in which China has already invested $200 million.
Singapore's state-owned PSA International Ltd. was given a 40-year contract to run the port, but Pakistan is contesting that in court, and wants more Chinese involvement, officials said.
The port will help Pakistan, struggling to revive its debt-laden economy, to become a conduit for trade to landlocked Afghanistan and Central Asia. It would also enable China to ship oil from the Gulf to its interior more directly.
India, of course, will loom large during talks: both Pakistan and China want to hem in India as a rising military power.
"In a way they give us (Pakistan), say, annually $2 billion," said analyst Khan. "What do we do? ... We're a pain in the ass for the Indians."
Chinese weapon sales to Pakistan, which make up a significant chunk of its annual arms exports, focus less on counter terrorism and counterinsurgency as favoured by the United States, and more on fighter jets, air-to-air missiles, tanks and other conventional weapons systems.
Such sales, as well as close diplomatic ties, mean China encourages Pakistan's military focus on India, to the annoyance of the United States, Pakistan's other major ally.
The United States wants Pakistan to rein in its homegrown militants and tackle sanctuaries for al Qaeda, the Afghan Taliban and other groups on its western border with Afghanistan.
But Pakistan appears more willing to help out China with its militant concerns than the United States in its war against the Taliban in Afghanistan, a country where Pakistan is seeking a prominent role in shaping any post-conflict government.
China is facing separatist demands from Muslim ethnic Uighurs in its western Xinjiang province, which borders Pakistan. On July 5, 2009, deadly clashes broke out between Uighurs and Han Chinese in Xinjiang, killing 197 people.
Though it usually champions Muslim separatists around the world, Pakistan deplored the riots and declared them an internal matter, winning praise from China.
The United States, however, says Pakistan is not doing enough: in a US review of the war in Afghanistan, Pakistan's struggle to crack down on militants was cited as a major concern.