The U.S. Senate unanimously passed a bill Tuesday aimed at supporting protesters in Hong Kong and warning China against a violent suppression of the demonstrations — drawing a rebuke from authorities in Beijing.

China reiterated Wednesday a threat to impose unspecified retaliation if the bill became law and urged the U.S. to stop meddling in Hong Kong affairs. Separately, the city’s government expressed “extreme regret” over the bill, saying it would negatively impact relations between Hong Kong and the U.S.

The Senate measure would require the State Department to certify annually whether Hong Kong remains sufficiently autonomous from Beijing to justify special trade privileges, as well as protect U.S. citizens from rendition to China through measures including sanctions on mainland officials.

The vote marks a challenge to the government in Beijing just as the U.S. and China, the world’s largest economies, seek to close a preliminary agreement to end their trade war.

The bill’s passage, as well as China’s threat of retaliation, hit stocks around the globe. Hong Kong’s Hang Seng Index lost as much as 1.1 percent Wednesday after surging 2.9 percent in two days, while U.S. stock index futures fell. The Topix index extended losses.

The legislation comes at a difficult time for U.S. President Donald Trump, as his administration is trying to complete the first phase of a long-awaited trade deal with Chinese leader Xi Jinping. Vice President Mike Pence said Tuesday that it would be tough for the U.S. to sign a trade agreement with China if the demonstrations in Hong Kong are met with violence.

“China is likely to take offense, and with that there will be negative effects for the ongoing trade war negotiations,” said Justin Tang, head of Asian research at United First Partners. “China is already fighting fires on both fronts and the Senate’s decision is unlikely to be well received. The market won’t receive this well either, given the uncertainly it creates.”

Hong Kong’s position as a global financial hub has already been shaken by months of protests and police responses that have grown increasingly violent. U.S. lawmakers have voiced strong support for the demonstrators and warned China against responding with violence, while Hong Kong authorities have said they are simply trying to enforce the law.

The likelihood of the U.S. government using the power in the near future to revoke Hong Kong’s special trading status — like similar legislation requiring high-level diplomatic and military visits to Taiwan — is very low. That’s not least because many Americans stand to lose money if some $38 billion in two-way trade is thrown into doubt.

In its statement, Hong Kong’s government noted the U.S. had a larger trade surplus with the city than any other jurisdiction, and mentioned that many American companies and citizens live there.

“Any unilateral change of U.S. economic and trade policy towards Hong Kong will create a negative impact on the relations between the two sides as well as the U.S.’s own interests,” it said.

U.S. Senate Majority Leader Mitch McConnell, a Kentucky Republican, on Monday urged Trump to personally voice support for the protesters, which he hasn’t yet done. Nor has Trump indicated whether he would sign the legislation if it got to his desk.

The House unanimously passed a similar bill last month, but slight differences mean both chambers still have to pass the same version before sending it to the president.

The time line for completing the trade agreement could collide with this legislation landing on Trump’s desk. A congressional aide said the Senate measure was drafted with help from Treasury and State Department officials, but a senior administration official on Monday cautioned that Trump’s seal of approval is the only one that matters.

China has repeatedly warned that there would be “strong countermeasures” for passing legislation supporting the Hong Kong protesters.

“President Trump may very well use this as a bargaining chip,” Teresa Kong, a portfolio manager at Matthews Asia in San Francisco, said in an interview on Bloomberg Television. “If he doesn’t sign the bill, it would very much be seen as an olive branch.”

The Senate measure passed by unanimous consent, which means there was no roll call vote because no senators objected to it. Republican Sen. Marco Rubio of Florida, the bill’s lead sponsor, said on Twitter before the vote Tuesday that the bill, S. 1838, would “head over to the U.S. House & then hopefully swiftly to the President.”

“The United States has treated commerce and trade with Hong Kong differently than it has commercial and trade activity with the mainland of China,” Rubio said on the Senate floor. “But what’s happened over the last few years is the steady effort on the part of Chinese authorities to erode that autonomy and those freedoms.”

The Senate on Tuesday also unanimously passed a bill to ban the export of munitions such as tear gas, pepper spray and rubber bullets to the Hong Kong police force. The House would still have to pass the same version of this measure as well for it to go to Trump to be signed into law.

That is one option: The House could simply take up the Senate bill. The other option would be to reconcile the differences between the two versions and have both chambers vote on the compromise bill.

Rep. Chris Smith of New Jersey, the lead Republican sponsor of the House bill, said he expected the House Foreign Affairs and Senate Foreign Relations committees to choose the latter option and work out the differences. He said the compromise could be included in a defense bill slated for a vote later this year.

“It tells Xi Jinping that there’s a price,” Smith said. “There’s one provision after another that says: We’re not kidding.”