Pro-democracy supporters hold their phone's flashlight in a rally to show support for students at The Hong Kong Poytechnic University on November 19, 2019 in Hong Kong, China.

The Senate unanimously approved both pieces of legislation, so they head to Trump's desk after House passage. The White House has not yet signaled where the president stands on the bills, but he could face a dilemma.

The chamber approved a measure that aims to protect human rights in Hong Kong by a 417-1 margin amid efforts to crack down on months of anti-government protests. The House passed a second bill to bar the export of certain munitions to Hong Kong police by the same margin.

The House passed a pro-Hong Kong rights bill on Wednesday, putting President Donald Trump in a bind as he tries not to roil high-stakes trade talks with China.

Chinese Foreign Ministry spokesman Geng Shuang said Beijing "condemns and firmly opposes" the first bill, known as the Hong Kong Human Rights and Democracy Act, according to Reuters. Trump aims not to anger the Chinese regime as he pushes for the elusive first piece of a U.S.-China trade agreement.

Congress' move to pass the bills comes at a tricky time for Trump, who hopes to have a China trade victory to promote on the 2020 campaign trail. Major U.S. stock indexes fell Wednesday after a Reuters report that the world's two largest economies may not finish a "phase one" trade deal this year.

Trump is likely to sign the legislation, a source familiar with the matter said. The president did not answer shouted questions from reporters Wednesday about whether he would sign the bills. The measures passed with near-unanimous support in both chambers, meaning Congress could likely override a Trump veto.

The government response to months of anti-government protests in Hong Kong, a semiautonomous region, has grown increasingly violent. The demonstrations first started in response to a since scrapped bill that would have allowed extradition to mainland China.

Some members of the Trump administration such as Secretary of State Mike Pompeo have harshly criticized China's response to the protests. Trump has said China should handle the situation itself, though he has warned harsh treatment of people in Hong Kong could derail the trade talks.

One bill passed this week would require Pompeo to certify once a year that Hong Kong has enough autonomy to keep special U.S. trading consideration that helps its economy. It would also set up the potential for sanctions on people responsible for human rights abuse in Hong Kong.

The second measure would bar the sale of items such as tear gas and rubber bullets to Hong Kong police.

In a statement following the House vote, Senate Foreign Affairs Committee Chairman Jim Risch, R-Idaho, called it "an important step forward in holding the Communist Party accountable." Sen. Marco Rubio, a Florida Republican who pushed for the bipartisan measure's passage, said he urged Trump to "sign this critical bill into law as soon as possible."

Senate Minority Leader Chuck Schumer, D-N.Y., said in a statement that Congress showed the U.S. "stands with the democratic protesters in Hong Kong and the suppression of freedom will not stand."

Asked about the trade talks earlier Wednesday, Trump said Beijing wants to strike a trade agreement more than he does. He added that he has not made a deal because "I don't think they're stepping up to the level that I want."

Subscribe to CNBC on YouTube.