China warned the United States on Thursday that it would take "firm counter measures" in response to U.S. legislation backing anti-government protesters in Hong Kong, and said attempts to interfere in the Chinese-ruled city were doomed to fail. U.S. President Donald Trump on Wednesday signed into law congressional legislation which supported the protesters, despite angry objections from Beijing, with which he is seeking a deal to end a damaging trade war. Protesters in Hong Kong responded by staging a "Thanksgiving" rally, with thousands, some draped in U.S. flags, gathering in the heart of the city. "The rationale for us having this rally is to show our gratitude and thank the U.S Congress and also President Trump for passing the bill," said 23-year-old Sunny Cheung, a member of the student group that lobbied for the legislation. "We are really grateful about that and we really appreciate the effort made by Americans who support Hong Kong, who stand with Hong Kong, who do not choose to side with Beijing," he said, urging other countries to pass similar legislation.

Pro-democracy protesters at a Thanksgiving Day rally on November 28, 2019 in Hong Kong. Chris McGrath | Getty Images News | Getty Images

The law requires the State Department to certify, at least annually, that Hong Kong is autonomous enough to justify favorable U.S. trading terms that have helped it become a world financial center. It also threatens sanctions for human rights violations. The Chinese foreign ministry said the United States would shoulder the consequences of China's countermeasures if it continued to "act arbitrarily" in regards to Hong Kong. Chinese Vice Foreign Minister Le Yucheng summoned U.S. Ambassador Terry Branstad and demanded that Washington immediately stop interfering in China's domestic affairs. Hong Kong's Beijing-backed government said the legislation sent the wrong signal to demonstrators and "clearly interfered" with the city's internal affairs. China is considering barring the drafters of the legislation, whose U.S. Senate sponsor is Florida Republican Marco Rubio, from entering mainland China as well as Hong Kong and Macau, Hu Xijin, the editor of China's Global Times tabloid, said on Twitter.

'Sinister intentions'

More than 5,800 people have been arrested since the unrest broke out in June over a proposal to allow extraditions to mainland China, the numbers grew in October and November as violence escalated. Demonstrators are angry at police violence and what they see as Chinese meddling in freedoms promised to Hong Kong when it returned to Chinese rule in 1997, such as an independent judiciary.

China says it is committed to the "one country, two systems" formula put in place at the handover, and blames foreign forces for fomenting the unrest, an allegation it repeated in response to the U.S. law. "This so-called legislation will only strengthen the resolve of the Chinese people, including the Hong Kong people, and raise awareness of the sinister intentions and hegemonic nature of the U.S.," the foreign ministry said. "The U.S. plot is doomed." Foreign ministry spokesman Geng Shuang declined to comment on any countermeasures planned by Beijing. "You better stay tuned, and follow up on this," he said. "What will come will come." Gao Feng, a spokesman for China's commerce ministry, did not comment directly on whether the law would affect trade talks, saying there were no new details of their progress to disclose. Some analysts say any move to end Hong Kong's special treatment could harm the United States, which has benefited from business-friendly conditions in the territory.

Lull in violence

Anti-government protests have roiled the former British colony for six months, at times forcing businesses, government, schools and even the international airport to close. Hong Kong has enjoyed a rare lull in violence over the past week, with local elections on Sunday delivering a landslide victory to pro-democracy candidates. Prominent activists Joshua Wong and Denise Ho addressed the rally on Thursday night, thanking front line protesters for the passage of the bill. Crowds sang the protest anthem "Glory to Hong Kong," waving their phone torches. Several hundred people also gathered outside the Polytechnic University, which police entered after a nearly two-week siege. "The situation in Poly U is still a disaster," said 30-year-old Ng, dressed in black and wearing a surgical mask. "We are out to show we will never forget the Poly U incident."

A protester runs during an attempt to leave The Hong Kong Polytechnic University on November 18, 2019 in Hong Kong. Anthony Kwan | Getty Images News | Getty Images