A proposal to fortify security at the U.S. Capitol passed the House by the narrowest of margins on Thursday, as Democratic leaders scrambled to overcome party defections a day after winning bipartisan backing for a commission to investigate the Jan. 6 pro-Trump riot.

Democrats failed to close ranks around the $1.9 billion measure as every voting Republican balked at the proposal, saying that the price tag was too hefty and that Congress hadn’t done enough to guarantee the money would be spent wisely.

Democratic opposition came exclusively from liberal members of the party who have broken with its leaders in the past — and in recent months have advocated reducing funding for police operations nationwide, a campaign that began last year as part of the country’s reckoning over racial justice in law enforcement. Their opposition to Thursday’s bill highlights the challenges House Speaker Nancy Pelosi (D-Calif.) will face as she tries to keep her razor-thin majority united, an undertaking that will only get more complicated as Congress draws closer to the 2022 midterm elections.

The 213-to-212 vote was a nail-biter as Democratic leaders, on the House floor, made emphatic last-minute appeals to the holdouts, pleading with them to back the measure. As Thursday’s vote closed, cries of, “One more!” could be heard from the GOP side of the chamber, prompting the Democratic leader, Rep. Steny H. Hoyer (Md.), to declare that they had run out of time and demand the final count be called.

The three members who voted no — Reps. Ayanna Pressley (Mass.), Cori Bush (Mo.) and Ilhan Omar (Minn.) — released a joint statement Thursday saying that “a bill that pours $1.9 billion into increased police surveillance and force without addressing the underlying threats of organized and violent white supremacy, radicalization, and disinformation that led to this attack will not prevent it from happening again.”

Reps. Alexandria Ocasio-Cortez (N.Y.), Rashida Tlaib (Mich.) and Jamaal Bowman (N.Y.), all Democrats, voted “present” ­­— officially taking no position, and allowing the bill to pass by one vote.

The rocky finish marred an otherwise triumphant week for Pelosi, who on Wednesday secured the backing of 35 House Republicans in passing legislation to create the Jan. 6 commission despite the opposition of House GOP leaders. But victory still hinges on whether Democrats can maintain and expand on that bipartisan spirit in the Senate, where the fates of both the spending bill and commission legislation remain uncertain.

Thursday’s squeaker of a win in the House portends the difficult road ahead. The hurdles facing both bills are steeper in the Senate: While Democrats and Republicans each control half of that chamber, it takes 60 votes to get around a procedural filibuster.

In February, seven Republicans broke ranks and voted to convict former president Donald Trump of impeachment charges for inciting the insurrection. One of those senators, Richard Burr of North Carolina, said Thursday that he opposes a commission, saying he didn’t think it was “necessary or wise.”

Senate Minority Leader Mitch McConnell (R-Ky.) on Wednesday voiced his opposition to the commission, less than 24 hours after stating that Senate Republicans were “willing to listen,” escalating the political risk for those in the GOP who may side with Democrats. The bipartisan commission would have subpoena power that could be used to draw Trump and his congressional allies into the investigation.

The House’s weak mandate for the spending bill also creates incentives for Senate Republicans to demand changes to the legislation.

Two Senate committees are finalizing their own recommendations for Capitol security improvements, which they plan to release jointly as soon as next week, part of their ongoing investigation of the riot and its causes. It is unlikely the Senate will complete its consideration of the House-passed spending package until that interim report is produced.

Republicans in both chambers have balked at some of the items in the bill, such as the $200 million dedicated to establishing a “quick reaction force” within the D.C. National Guard so the Capitol Police can draw upon military reinforcements more speedily in future emergencies. On Thursday, House Republicans also alleged that the bill was premature because Congress has not taken steps to reform the Capitol Police Board, which oversees the force.

“There is no question we must support the men and women of the Capitol Police, we must provide them the equipment, the training, and the leadership that support their efforts,” said Rep. Jaime Herrera Beutler (R-Wash.), the top Republican on the appropriations subcommittee that controls funding for the government’s legislative branch. “But to say that five months later, we’re going to put the money before the actual reform, to me says there’s a dereliction of duty.”

Herrera Beutler, one of 10 House Republicans who earlier this year voted to impeach Trump, directed her criticism toward the House Administration Committee, which on Wednesday held its first hearing with current members of the Capitol Police Board. The House sergeant-at-arms, who was not in that position on Jan. 6, rejected the idea that the board needs reform; the Senate sergeant-at-arms, also appointed after the Capitol attack, declined to appear.

Speaking Thursday on the House floor, Rep. Zoe Lofgren (D-Calif.), who chairs that panel, took umbrage at Herrera Beutler’s criticism.

“It’s not clear at the moment . . . whether it’s failings of the structure or failings of the individuals holding the positions in that structure,” said Lofgren. She said that “it is a mistake to say if we can’t do everything at the same time, we should do nothing. . . . The failure to act today is really to turn your backs on the men and women who fought as Capitol Police officers just yards from where we stand today.”

The legislation seeks to pay for updating the equipment and training that are provided to Capitol Police, and for hardening the Capitol complex with movable fencing, additional surveillance equipment, and reinforced windows and doors. It attempts to provide for extra security for lawmakers who have been threatened, both in Washington and in their home districts. In addition, it directs funds to pay for security improvements in the federal courts, which have also experienced a significant uptick in threats.

But the largest portion of the legislation — almost $700 million — goes to pay for costs that were already incurred by the Capitol Police, the D.C. police, the National Guard and other federal agencies that responded to the riot as it was unfolding or stuck around in the weeks that followed to help patrol the vulnerable Capitol campus.

The discourse ahead of Thursday’s vote grew testy as Democrats accused Republicans of forgetting the horrors of Jan. 6 and attempting “to rewrite history,” while Republicans charged that if Democrats really wanted to make the country safer, they should be spending taxpayer money elsewhere.

“The true emergencies we should be funding are not part of this bill,” said Rep. Tony Gonzales (R-Tex.), listing the immigration crisis at the southern border and the hostilities between Israel and Hamas as more pressing matters, as he accused Democrats of running a “tone deaf” debate.

Toward the end of Thursday’s debate, Pelosi spoke on the floor to advocate for the bill, saying that the House had already collected ample advice about what improvements are necessary to help fortify the Capitol and protect its occupants, including from a task force she appointed retired Lt. Gen. Russel Honoré to lead.

“This is what is urgent for us to do now,” Pelosi said. “We have to prioritize, we need to sequence; we can’t wait until we have every answer before we start with the solutions that we are aware, that we know of.”

Herrera Beutler immediately challenged the speaker to do a better job of cementing the changes she advocated in law, before asking Congress to pay for them.

“I’m not saying hold everything back,” Herrera Beutler retorted. “At least take General Honoré’s report and implement it, and then I wouldn’t be as opposed to funding it.”