BEIJING — China reacted furiously Thursday to President Donald Trump’s signing two bills aimed at supporting human rights in Hong Kong, summoning the U.S. ambassador to protest and warning the move would undermine cooperation with Washington.

Hong Kong, a former British colony that was granted semi-autonomy when China took control in 1997, has been rocked by six months of sometimes violent pro-democracy demonstrations.

Thousands of pro-democracy activists crowded a public square in downtown Hong Kong on Thursday night for a “Thanksgiving Day” rally to thank the United States for passing the laws and vowed to “march on” in their fight.

Trump’s approval of the bills was not unexpected. Neither was the reaction from Beijing, given China’s adamant rejections of any commentary on what it considers an internal issue.

Nevertheless, the clash comes at a sensitive time and could upset already thorny trade negotiations between the two nations.

Chinese Vice Foreign Minister Le Yucheng told U.S. Ambassador Terry Branstad that the move constituted “serious interference in China’s internal affairs and a serious violation of international law,” a foreign ministry statement said.

Le called it a “nakedly hegemonic act.” He urged the U.S. not to implement the bills to prevent greater damage to U.S.-China relations, the ministry said.

In a statement about the meeting, the U.S. Embassy in Beijing said, “the Chinese Communist Party must honor its promises to the Hong Kong people.”

The U.S. “believes that Hong Kong’s autonomy, its adherence to the rule of law, and its commitment to protecting civil liberties are key to preserving its special status under U.S. law,” it said.

The U.S. laws, which passed both chambers of Congress almost unanimously, mandate sanctions on Chinese and Hong Kong officials who carry out human rights abuses in Hong Kong, require an annual review of Hong Kong’s favorable trade status and prohibit the export to Hong Kong police of certain nonlethal munitions.

“I signed these bills out of respect for President Xi, China, and the people of Hong Kong,” Trump said in a statement. “They are being enacted in the hope that Leaders and Representatives of China and Hong Kong will be able to amicably settle their differences leading to long term peace and prosperity for all.”

Prominent Hong Kong activist Joshua Wong, who was among those who lobbied for the U.S. laws, said it was remarkable that human rights had triumphed over the U.S.-China trade talks. Wong told Thursday’s rally that the next aim is to expand global support by getting Britain and other Western nations to follow suit.

Since the Hong Kong protests began in June, Beijing has responded to expressions of support for the demonstrators from the U.S. and other countries by accusing them of orchestrating the unrest to contain China’s development. The central government has blamed foreign “black hands” bent on destroying the city.

C.Y. Leung, a former chief executive of Hong Kong, said at a talk at the Foreign Correspondents Club of Hong Kong that he doubts the U.S. or supporters of the bills “ever had the interest of Hong Kong in mind.”

He suggested Hong Kong was being used as a “proxy” for China and the legislation was a way to hit back at Beijing.

While China has repeatedly threatened unspecified “countermeasures,” it’s unclear exactly how it will respond. Speaking on Fox News, Trump called the protests a “complicating factor” in trade negotiations with Beijing.

At a daily briefing, Chinese Foreign Ministry spokesman Geng Shuang responded to a question about how Trump’s endorsement of the legislation might affect the trade talks by saying it would undermine “cooperation in important areas.”

Asked Thursday if the U.S. legislation would affect trade talks with Washington, a Chinese Commerce Ministry spokesman said he had no new information to share.

Recently both sides expressed confidence they were making headway on a preliminary agreement to avert a further escalation in a tariff war that has hammered manufacturers in both nations.

___

Associated Press writers Eileen Ng in Hong Kong and Elaine Kurtenbach in Beijing contributed to this report.