House and Senate lawmakers on Thursday approved a bill to fund the federal government into early next year, narrowly averting a shutdown after some Republicans sought to seize on the imminent fiscal deadline to fight President Biden over his vaccine policies.

The two successful evening votes spelled an end to a brief yet tense period that would have brought Washington to a halt come Saturday morning, a development that Democrats had described as irresponsible and dangerous in the middle of a deadly pandemic.

The new agreement, which awaits Biden’s signature, covers federal spending until Feb. 18. At that point, lawmakers must adopt another short-term measure or complete work on a dozen long-stalled appropriations bills that fund the government for the remainder of fiscal 2022, which ends in September.

Even as both parties insisted they did not want to push the country toward a fiscal cliff, they still came dangerously close to missing their deadline. For days, conservative Republicans had threatened to hold up the funding bill as part of a long-running protest of Biden’s vaccine directives, including those ordering large employers to require inoculations or implement comprehensive testing programs. Some lawmakers, including Rep. Marjorie Taylor Greene (R-Ga.), even explicitly called for a shutdown in a bid to deny the White House the ability to enforce its rules.

While many public health experts have said vaccine policies have helped combat the pandemic, conservatives charged that Biden’s mandates are unconstitutional and threaten Americans’ rights and jobs. They mobilized most aggressively in the Senate, where Republicans including Roger Marshall of Kansas, Ted Cruz of Texas and Mike Lee of Utah threatened to hold up debate in the narrowly divided chamber, a move that raised the risk that federal funding could lapse.

“My phone has blown up and continues to blow up over the vaccine mandate issue,” Marshall told reporters earlier in the day, insisting it would result in millions of Americans losing their jobs. “I don’t want to shut the government down.”

The Post’s Paul Kane explains how a group of Republicans objecting to federal vaccine requirements could potentially force a government shutdown. (Adriana Usero, JM Rieger/The Washington Post)

In the end, though, Senate leaders brokered an agreement that eased the logjam, allowing Republicans to take a vote on an amendment that would have defunded vaccine mandates applying to businesses, as well as those targeting military service-members and federal employees. That effort ultimately failed on an 48-to-50 vote, with two Republicans absent. The Senate then adopted the final stopgap bill on a 69-to-28 vote. The House approved the bill earlier in the evening largely along party lines.

For many lawmakers, the entire saga only served to highlight the extent of the political acrimony on Capitol Hill, where even the most basic responsibilities of governance quickly devolve into partisan showdowns. And it underscored the extent to which conservatives in Congress see the president’s stance on vaccines as a vector to mount prominent political attacks, a campaign that Republicans have pledged to continue in the days ahead.

“We have seen in the course of this pandemic Democrats being very comfortable with being petty tyrants and decreeing that you must obey their medical mandates,” said Cruz, who has played a lead role in prompting at least one shutdown in the past.

Washington is no stranger to government shutdowns, though each one has played out differently. For the most part, many federal operations continue during a funding lapse: Social Security and Medicare benefits do not halt, the Postal Service continues delivering mail, and military functions can proceed.

At times, though, the disruptions can prove significant. National parks often close, though the Trump administration tried to keep them open during a lengthy shutdown two years ago in manner that some budget experts said violated federal law. Passport applications can be delayed, and foreign embassies can curtail services. Federal agencies shutter many services deemed nonessential, sometimes delaying things such as tax filings and passport applications.

For many workers, meanwhile, the implications can be severe. Hundreds of thousands of federal employees are often sent home or forced to work without pay. Those furloughs and other consequences may not rear their heads if a shutdown only occurs into a weekend, but disruptions could prove more troublesome for families and businesses if they drag on.

With these consequences in mind, Democrats and Republicans began Thursday on a hopeful political note, brandishing a new, bipartisan funding deal. Known as a continuing resolution, it covered key federal agencies and programs into February while authorizing an additional $7 billion to assist Afghan evacuees. But the bill generally did not address a wide array of unresolved policy issues that lawmakers had hoped to tackle before the end of the year, a reflection of the tensions that have delayed progress on a slew of longer-term spending measures for months.

“While I wish it were earlier, this agreement allows the appropriations process to move forward toward a final funding agreement which addresses the needs of the American people,” said Rep. Rosa L. DeLauro (D-Conn.), the leader of the House Appropriations Committee.

Sen. Richard C. Shelby (Ala.), the top Republican on the chamber’s appropriations panel, later offered his own blessings: “I’m pleased that we have finally reached an agreement on the continuing resolution. Now we must get serious about completing [fiscal 2022] bills.”

Rep. Marjorie Taylor Greene (R-Ga.) on Dec. 2 called for a government shutdown during a speech on the House floor, bemoaning the rising national debt. (U.S. House of Representatives)

Hours later, House lawmakers adopted the short-term resolution on a 221-to-212 vote, following a brief yet tense debate. Taking to the chamber floor, House Majority Leader Steny H. Hoyer (D-Md.) blasted the GOP for failing to provide “any help” toward funding the government even as the deadline rapidly approached.

“This is a result of the inability of the Congress to work,” he said.

House Republican leaders, in contrast, encouraged their members to oppose the spending stopgap. In doing so, they argued that Democrats had failed to negotiate in earnest because they spent too much time trying to advance Biden’s broader economic agenda, including a long-stalled, roughly $2 trillion spending package that GOP lawmakers vehemently oppose. All but one — Rep. Adam Kinzinger (R-Ill.) — later opposed the funding bill.

“This government should be shut down,” Greene said, citing a need to rein in the federal deficit only days after she called for denying funding for enforcing the vaccine and testing rules. “You want to know why it should be shut down? Because the people in here. The people in here cannot control themselves.”

While the House ultimately muscled through the GOP objections, Senate leaders found themselves confronting a more treacherous fight — chiefly as conservatives raised new objections around vaccines.

Speaking from the well of the chamber, Lee earlier Thursday blasted Biden and alleged that the vaccine-and-testing policies were unconstitutional. Lee slammed Senate Majority Leader Charles E. Schumer (D-N.Y.) specifically, stressing that conservatives for weeks had made clear to him that they planned to push an effort to defund the mandates as part of the debate over federal funding.

“I am glad that in the end, cooler heads prevailed-- the government will stay open,” Senate Majority Leader Charles E. Schumer (D-N.Y.) said on Dec. 2. (The Washington Post)

“I don’t want to shut down the government,” Lee said. “The only thing I want to shut down is Congress funding enforcement of an immoral, unconstitutional vaccine mandate.”

Democrats, in turn, lambasted the obstruction, stressing the fracas threatened to undermine the country’s response to the coronavirus, particularly at a time when a new, concerning variant is spreading globally.

“We should be doing everything we can to stop this virus. We should be using every tool to keep America safe,” Sen. Patty Murray (D-Wash.) said just before voting began.

In allowing a vote on an amendment, Senate leaders ultimately put an end to the political stalemate. But that option for hours appeared shrouded in its own political uncertainty, after Sen. Joe Manchin III (D-W.Va.) unexpectedly expressed an openness to supporting the proposal. Even though he opposed a similar vote this fall, it occurred before the president announced his vaccine and testing policies targeting private businesses.

“I’ve been very supportive of a mandate for federal government, for military, for all the people who work on a government payroll,” Manchin said. “I’ve been less enthused about it in the private sector. So we’re working through all that.”

Manchin, however, ultimately voted against Republicans’ proposal, which targeted some of the vaccine policies he did support.

Even among GOP lawmakers, the conservatives’ strategy proved controversial, leaving some to fear that they might have been blamed politically if a shutdown had occurred. Some Republicans pointed out that the gambit seemed particularly ill-fated since the spending stopgap had the necessary votes to prevail anyway.

“I don’t think either Republicans or Democrats want a shutdown,” said Sen. John Cornyn (R-Tex.). “But sometimes we can be our own worst enemy.”

Tyler Pager contributed to this report.