China Said to Have Made Call to Let Leaker Depart BEIJING - The Chinese government made the final decision to allow Edward J. Snowden, the former National Security Agency contractor, to leave Hong Kong on Sunday, a move that Beijing believed resolved a tough diplomatic problem even as it reaped a publicity windfall from Mr. Snowden's disclosures, according to people familiar with the situation. Hong Kong authorities have insisted that their judicial process remained independent of China, but these observers - who like many in this article spoke on the condition of anonymity to talk freely about confidential discussions - said that matters of foreign policy are the domain of the Chinese government, and Beijing exercised that authority in allowing Mr. Snowden to go. From China's point of view, analysts said, the departure of Mr. Snowden solved two concerns: how to prevent Beijing's relationship with the United States from being ensnared in a long legal wrangle in Hong Kong over Mr. Snowden, and how to deal with a Chinese public that widely regards the American computer expert as a hero. "Behind the door there was definitely some coordination between Hong Kong and Beijing," said Jin Canrong, professor of international relations at Renmin University in Beijing. Beijing's chief concern was the stability of the relationship with the United States, which the Chinese believed had been placed on a surer footing during the meeting between President Xi Jinping and President Obama at the Sunnylands estate in California this month, said Mr. Jin and a person knowledgeable about the Hong Kong government's handling of Mr. Snowden. The Chinese government was pleased that Mr. Snowden disclosed the extent of American surveillance of Internet and telephone conversations around the world, giving the Chinese people a chance to talk about what they describe as American hypocrisy regarding surveillance practices, said Mr. Jin and the person familiar with the consultations between Hong Kong and China. But in the longer term, China's overall relationship with the United States, which spans global economic, military and security issues, was more important than the feelings of the public in China and Hong Kong, who felt that the contractor should be protected from the reach of the United States, analysts said. Mainland Chinese officials "will be relieved he's gone - the popular sentiment in Hong Kong and China is to protect him because he revealed United States surveillance here, but the governments don't want trouble in the relationship," said the person familiar with the consultations between Beijing and Hong Kong. Mr. Snowden went public in Hong Kong on June 9, the day after the meeting between Mr. Obama and Mr. Xi ended, as the source of a series of disclosures in the British newspaper The Guardian and The Washington Post about classified national security programs. The stream of information about the extent of American worldwide eavesdropping shifted the focus in the public sniping between the Obama administration and China over cybersecurity that had been unfolding for months. In a series of speeches, senior officials in the Obama administration, including the national security adviser, Tom Donilon, and the defense secretary, Chuck Hagel, had taken the offensive against China, publicly accusing it of cyberespionage against American businesses. Mr. Donilon said in a speech in March that China was responsible for theft of confidential business information and proprietary technologies through digital intrusions on an "unprecedented scale." In response to those accusations, China said that it was the victim of cyberattacks from the United States. Mr. Snowden's disclosures appeared to confirm the Chinese government's argument, and put the United States on the defensive. The highly classified documents that Mr. Snowden gave to the two newspapers showed that the N.S.A. compiled logs of virtually all telephone calls in the United States and collected the e-mail of foreigners from American Internet companies. Mr. Snowden has denied giving China classified documents and said he had spoken only to journalists. But his public statements, directly and to reporters, have contained intelligence information of great interest to China. Two Western intelligence experts, who worked for major government spy agencies, said they believed that the Chinese government had managed to drain the contents of the four laptops that Mr. Snowden said he brought to Hong Kong, and that he said were with him during his stay at a Hong Kong hotel. If that were the case, they said, China would no longer need or want to have Mr. Snowden remain in Hong Kong. The disclosures by Mr. Snowden set off a surge of commentary against American "double faced" and "arrogant" behavior by many users of China's version of Twitter. In some instances, the Chinese news media made snide references to what it called the gap between how the United States portrayed itself, and what the United States practiced. "Washington must be grinding its teeth because Snowden's revelations have almost overturned the image of the U.S. as the defender of a free Internet," Global Times, which often reflects the official point of view, wrote in an editorial. The precise details of how the Chinese government dealt with Hong Kong authorities were not immediately known. But Beijing appears to have decided that weeks of focus on Mr. Snowden in Hong Kong and his disclosures about the American government's global surveillance practices were enough, and that he could turn into a liability, said a second person familiar with the handling of Mr. Snowden. "Beijing has gotten the most they can out of the Snowden situation," that person said. A senior diplomat familiar with the way the Chinese government works said just before the departure of Mr. Snowden became public that he believed that Beijing would do all it could to keep Mr. Snowden out of American hands. The Chinese public would be outraged if the contractor was extradited, put on trial and jailed, he said. At the same time, the Obama administration would put relentless pressure on Beijing to get Mr. Snowden, he said. "I see the sun of Sunnylands disappearing into the snow of Snowden," the diplomat said. Jane Perlez reported from Beijing, and Keith Bradsher from Hong Kong.