President Asif Ali Zardari is scheduled to visit China for four days starting Tuesday, in an effort to reinforce Pakistan's ties with a traditional ally at a time when relations with the US have come under considerable strain. President Zardari's visit comes barely two weeks after Gen. Ashfaq Parvez Kayani, the country's military chief, made a five-day visit to China. The high-profile visits signify the importance Pakistan attaches to China, a neighbor that is considered a close and reliable ally. The relationship between the countries is unlike the relationship between Pakistan and the United States, which has been rocky and often complicated, and based on short-term needs and expediency. Arif Rafiq, an analyst of Pakistan politics, said, however, that "the two closely timed visits to China by President Zardari and General Kayani are not part of a strategy by Pakistan to play Beijing and Washington off one another." Rather, he said the timing was coincidental. Pakistan, facing economic difficulties, is looking to China for foreign aid and closer economic cooperation. Mr. Zardari will also push for cooperation to assist Pakistan's civilian nuclear program. To overcome an acute energy shortage, Pakistan relies on nuclear energy for power generation. Zardari had announced he would visit China last month, soon after assuming office, following the precedent set by other leaders. But his visit was postponed, which drew strong criticism by nationalists and opinion writers. Many of them accused the government of downgrading relations with China while trying to placate the United States. Pakistani officials deny these assertions.  "Pakistan's relations with the United States and China are not an either-or proposition," said Husain Haqqani, the Pakistani ambassador to Washington, who is thought to be the intellectual driving force behind the government's foreign policy. "While some armchair analysts might look unfavorably upon Pakistan's simultaneous pursuit of close relations with China and the United States," he said, "policy makers in Washington and Beijing share interest in strengthening Pakistan and do not see our country as an area of contention between the two powers." Mr. Haqqani emphasized that during the 1970s, Pakistan acted as a bridge between the United States and China. The early relationship between Pakistan and China stemmed in large part from an effort to provide a bulwark against India. Both countries have fought wars against India.  Pakistan's military ties with China remain strong, and China has assisted Pakistan in tank production, fighter aircraft manufacturing and naval technology.  But since the late 1990s, economic concerns have gained increased importance. Trade and energy have taken precedence in Pakistan's relations with China. Trade between the countries is more than $7 billion a year, and both sides have a target of $15 billion by 2010. In his first speech before the Parliament as president last month, Zardari vowed to take to greater heights what he called the "time-tested and all-weather friendship and strategic partnership with China."  He also said that Pakistan would not tolerate any violation of its sovereignty by "any power" " an allusion to the United States and its strikes inside Pakistani territory. American officials have expressed frustration with Pakistan's efforts to curb the Taliban and Al Qaeda in its restive, semiautonomous tribal regions along the border with Afghanistan. At the same time, there are areas in which the Chinese have also expressed dissatisfaction. China has asked Pakistan to ensure and enhance the security of its citizens, who have been increasingly singled out in Pakistan.