The Senate is voting Thursday on a bill aimed at countering China’s global economic and political influence. But despite the bill’s bipartisan sponsorship and a lengthy amendment process, last-minute opposition nearly imperiled its chances.

The Senate voted this week on multiple amendments to the U.S. Innovation and Competition Act, including votes on several amendments late Wednesday night. The Senate opened a cloture vote on the bill shortly after 11:00 on Thursday morning, which limits debate before a final vote. The bill remained open for more than three hours as negotiations on the bill continued behind the scenes over including more amendments.

The bill needed 60 votes to invoke cloture, and Democrats have a 50-seat majority — meaning that Senate Majority Leader Chuck Schumer needed support from at least ten Republicans in order for the legislation to advance. Several Republicans agreed to support cloture after a deal to vote on two more amendments was reached.

Many Republicans had been particularly frustrated about the lack of a vote on a bipartisan trade amendment by GOP Senator Mike Crapo and Democratic Senator Ron Wyden, the ranking member and chair of the Senate Finance Committee respectively. But hasty negotiations resulted in agreement to vote on the Wyden and Crapo amendment, which would extend trade preferences and tariff relief. The amendment was approved by a vote of 91 to 4, and another amendment by GOP Senator Marco Rubio was tabled.

The bill was a priority for Schumer, who wrote the base of it with Republican Senator Todd Young. In a speech on the Senate floor Thursday afternoon, Young said that the bill would counter Chinese efforts to become the dominant global power.

“Today we declare our intention to win this century and those that follow it as well,” Young said.

The delay in the cloture vote hindered the progress of another bill which would create a bipartisan commission to investigate the January 6 attack on the U.S. Capitol. The Senate cannot vote on that bill until it completes the process for the U.S. Innovation and Competition Act. If the Senate does not get to the commission bill by the end of this week, it will not be taken up until early June, as the Senate is in recess next week.

However, even if the Senate does vote to invoke cloture the commission bill today, it is unlikely to garner enough Republican support to advance.