More than 7,000 foreign nongovernment groups will be affected, according to state news reports.
Foreign groups working across Chinese civil society — on issues including the environment, philanthropy and cultural exchanges, and possibly even in education and business — will now have to find an official Chinese sponsor and must register with the police. This also applies to groups from Taiwan, Hong Kong and Macau.
Those organizations that do not receive official approval will be forced to stop operating in the country. Many groups will probably curtail or eliminate programs deemed politically sensitive, such as training lawyers, in order to remain.
Groups that may have a hard time getting approval include those promoting workers’ rights, ethnic equality and religious freedoms.
The new law is the latest in a series of actions taken by Mr. Xi against the kind of Western influences and ideas that he and other leaders view as a threat to the survival of the Communist Party, such as an independent judiciary and media.
Mr. Xi makes loud pronouncements about ideology, and is expected to enact other sweeping security laws. He has departed sharply from the direction of several of his predecessors, who for decades guided China in seeking out foreign expertise to modernize society. (He did, though, send his own daughter to Harvard.)
This latest move is also part of a wider global trend in which powerful nations, including Russia and India, are cracking down on nongovernment organizations and consolidating power in the state.
The prospect of the new law caused considerable anxiety among foreign and Chinese nongovernment organizations here after an early draft began circulating last year.
Countries including the United States began campaigning for Beijing to scrap or drastically change the proposed law. Universities also weighed in, since vague wording in early drafts indicated that educational institutions could be affected. Business associations raised objections as well.
On Thursday afternoon, the Standing Committee of the National People’s Congress, which puts an official stamp on the policies of the Chinese Communist Party, said the law had passed after a review of the third draft that began on Monday. It goes into effect Jan. 1, 2017.
The most draconian aspect of the earlier drafts remained, despite widespread outcry from foreign groups and governments. It requires that foreign nongovernment organizations register with the Ministry of Public Security and allow the police to scrutinize all aspects of their operations, including finances, at any time.
In China, where the domestic security apparatus has enormous power, the police could do that anyway, but foreign groups fear that the police will monitor their activities with much greater vigor given this newly formalized authority. The law states that any employee of such a group can be interrogated at any time.
In addition, such groups must find an official Chinese partner organization. The law does not define what kinds of Chinese groups will be approved partners, and it is unclear how that determination will be made and by whom. Foreign groups fear that Chinese organizations will not want to take the risk.
“I think more important than the law itself will be its implementation, and I think overseas NGOs now need to turn their focus to how they can be involved in the implementation process, which will be long and drawn out,” said Shawn Shieh, a deputy director at the China Labor Bulletin in Hong Kong who closely tracks the work of nongovernment groups in China.
The Public Security Ministry will need to hire staff members and take other steps to enact the law, he said, “and overseas NGOs will need to communicate frequently with Public Security, educate them and maybe even provide services such as workshops, trainings and advice on how to manage NGOs and their projects and activities in China.”
Some officials in Beijing have characterized foreign nongovernment groups as “black hands” working to undermine one-party rule in the country. Those suspicions have grown under Mr. Xi.
Officials have accused such groups of instigating the pro-democracy Umbrella Movement in Hong Kong and protests in Tibet, as well as trying to quietly usher Chinese society toward Western ways via what Mao Zedong called a “peaceful evolution.”
“The foreign NGO management law is like many other Xi-era initiatives: yet another tool to legalize human rights abuses,” said Sophie Richardson, the China director at Human Rights Watch.
Xinhua, the state news agency, said this week that the third draft of the law included a new phrase that broadly defined the groups affected by the law — groups “such as foundations, social groups or think tanks.”
The draft also said that academic and research groups and hospitals would be beholden to “relevant provisions of national law.”
Xinhua interpreted that to mean that those organizations might not fall under the new law, since foreigners had expressed concern over the potential harm to academic programs.
But Jeremy L. Daum, a senior researcher at the China Center of Yale Law School, noted on the China Law Translate blog that the language was vague and “somewhat confusing.”
China has not had regulations allowing for the registration of foreign nongovernment organizations, so almost all such groups have been operating here in a legal gray area.
Foreign legal experts say China should have a law that approves the work of such groups. But from a civil society perspective, they say, it makes no sense for the Ministry of Public Security, rather than the Civil Affairs Ministry, to be the regulator.
A few foreign nongovernment groups, including the Bill & Melinda Gates Foundation, do operate with official sanction in China now, but they will still need to comply with the mandatory police registration.
Certain types of nongovernment organizations — like groups that work with Chinese human rights activists or lawyers — will have little chance of finding an official partner or registering with the police.
One example is the Chinese Urgent Action Working Group, which a Chinese lawyer and a Swedish resident of Beijing founded seven years ago and registered as a business in Hong Kong.
The group offered legal training and assistance programs, supporting activist lawyers and grass-roots lawsuits against officials. In recent months, the police dismantled the group by arresting members. The Swede Peter Dahlin was detained in January and forced to make a televised confessionof so-called crimes before being deported.
Beijing is already suspicious of foreign and Chinese nongovernment organizations that receive funding from outside sources deemed politically suspect, like the National Endowment for Democracy and the Open Society Foundations, both based in the United States. Groups that operate here with any financing from those sources will be even more vulnerable under the new law.
The passage of the law also raises questions of whether more mainstream foreign nongovernment organizations will independently decide to cut certain programs, like initiatives promoting government transparency, or self-censor to secure a Chinese partner and register with the police.
There has been a heated debate this month over whether the American Bar Association withdrew an offer to publish a proposed book by Teng Biao, a Chinese human rights lawyer, to avoid any potential fallout from the Chinese government.
The bar association has a small office in Beijing that runs a rule-of-law program, although the headquarters said in a statement on Monday that its employees in China had no say in the decision.