The House on Thursday narrowly passed a nearly $2 billion spending package to bolster security in the Capitol in the wake of the Jan. 6 riot.

Most Republicans opposed the measure, which passed 213-212, with three Democratic members voting “present” and three opposing the bill. GOP lawmakers cited duplicative spending and objected to a provision that adds the National Guard to the Capitol security force.

It passed a day after Democrats and 35 Republicans voted to create a commission to investigate the Jan. 6 riot.

“This bill is a first step toward having more security for the building that lodges the legislative branch of government,” Rep. Zoe Lofgren, a California Democrat, said.

The Capitol perimeter has been protected by an 8-foot fence since shortly after Jan. 6. That day, hundreds of angry protesters supporting then-President Donald Trump pushed their way into the building, smashing doors and windows and injuring overwhelmed police officers in a quest to track down lawmakers voting to certify Joe Biden the winner of the presidential election.

Since that day, thousands of National Guard troops have been stationed on the campus for additional protection.

The measure lawmakers passed on Friday aims to replace the permanent fence and the daily presence of the National Guard with improved security and infrastructure that would make the Capitol more resistant to a Jan. 6-style attack.

The House vote was delayed. Democrats control a bare majority, and several liberal lawmakers objected to parts of the bill. Democratic leaders needed the time to twist arms within their own caucus since it appeared Republicans would vote against the bill and leave passage in jeopardy.

The measure would dedicate $529 million to harden the Capitol with stronger doors and windows as well as new screening vestibules for police. It would fund retractable or “pop-up” fencing that could be deployed quickly in the event of another riot.

The measure also includes more than $10 million for police equipment, including body cameras and riot gear, which officers said was lacking on the day of the riots and left them underequipped to fend off the rioters.

A provision in the measure would provide all officers with body cameras but would exclude those on protective detail for lawmakers, including the leadership.

Republicans objected to multiple spending provisions in the bill, among them $200 million to establish a “quick reaction force” within the D.C. National Guard that could be deployed to augment the Capitol Police if the campus came under threat.