China said Monday it will suspend U.S. military ship and aircraft visits to Hong Kong and sanction several American pro-democracy and human rights groups in retaliation for the signing into law of legislation supporting anti-government protests in the semi-autonomous territory.

The move followed Chinese warnings that the U.S. would bear the costs if the Hong Kong Human Rights and Democracy Act was approved.

The law, signed last Wednesday by President Donald Trump, mandates sanctions on Chinese and Hong Kong officials who carry out human rights abuses and requires an annual review of the favorable trade status that Washington grants Hong Kong.

The legislation was backed by U.S. lawmakers who are sympathetic to the protesters and have criticized Hong Kong police for cracking down on the pro-democracy movement.

Police say their use of tear gas, rubber bullets and other force is a necessary response to escalating violence by the protesters, who have blocked major roads and thrown gasoline bombs back at officers in riot gear.

Hong Kong has been living with almost nonstop protests for six months. The movement’s demands include democratic elections and an investigation into the police response. More fundamentally, the protesters and others in Hong Kong fear that China is eroding the rights and freedoms they have under a “one country, two systems” framework.

Beijing imposes many restrictions on non-governmental organizations, and is in particular concerned about those involved in humanitarian causes, gender equality, the environment or minority rights.

The protests are blamed for driving the economy into recession. Tourism, airline and retail sectors have been hit in particular hard, with retail sales down about 20%.