WASHINGTON -- The government shutdown is dead. Obamacare is alive.
The Senate voted 81 to 18 Wednesday night to reopen the federal government and raise the nation's borrowing limit, hours before the Treasury Department faced the possibility of being unable to pay all of America's bills for the first time in modern history.
The House followed suit, voting 285-144 to end the latest damaging battle of divided government in a polarized Congress.
President Barack Obama signed the legislation early Thursday. He said he would reopen the government immediately to "lift this cloud of uncertainty and unease" that settled on the nation and start fixing the damage.
"There is a lot of work ahead of us, including our need to earn back the trust of the American people that has been lost over the last few weeks," Obama said in a brief speech at the White House.
The standoff began over the summer, when tea party Republicans, led by Texas Sen. Ted Cruz, demanded that the House of Representatives lock government funding in a chokehold unless Democrats and Obama defunded the Affordable Care Act.
Democrats opted for defend over defund, with Obama declaring he would not negotiate over his signature law, the budget or the debt while Republicans were holding hostages.
It set up 16 days of furloughed federal workers, closed parks, halted safety inspections, and the estimated loss of $24 billion in economic activity. The ugly headlines overshadowed the bumpy rollout of Obamacare.
Boehner and the tea party were finally forced to release their grip Wednesday by a bipartisan coalition in the U.S. Senate that said enough is enough, and the looming deadline of potential default starting Thursday.
“The House has fought with everything it has to convince the president of the United States to engage in bipartisan negotiations aimed at addressing our country's debt and providing fairness for the American people under Obamacare," Boehner said after he finally waved the white flag. "That fight will continue. But blocking the bipartisan agreement reached today by the members of the Senate will not be a tactic for us."
All that Republicans got for the bruising battle was a fig leaf provision on Obamacare and record low approval ratings.
The bill agreed upon by Senate Majority Leader Harry Reid (D-Nev.) and Minority Leader Mitch McConnell (R-Ky.) will fund the government through Jan. 15 and extend the $16.7 trillion debt ceiling through Feb. 7. It also includes back pay for unpaid and furloughed federal workers and an agreement that both chambers would open a budget conference committee for the first time in years.
The lone change to Obamacare was minimal, and Democrats said they liked it. It involves putting tighter restrictions on income verification standards for people receiving subsidies in the Affordable Care Act's new insurance marketplaces. It was a far cry from defunding or delaying the law, as many Republicans conceded the strategy to focus the fight on Obamacare had been wrong from the start.
Republicans did notch a significant victory in the final deal. It funds the government until mid-January at the sequestration levels specified by the 2011 Budget Control Act that ended the last debt showdown. But Republicans had won that concession from Democrats weeks before the House set out on its doomed effort to strangle Obamacare.
"The sad truth is, we ended up where we started," said Sen. Chuck Schumer (D-N.Y.). "We achieved our goal, but at a cost. It never should have been this way."
Cruz grabbed one final moment in the spotlight, railing on the Senate floor against letting the Treasury Department pay the debts Congress has run up and putting federal workers back on the job.
"This is a terrible deal," Cruz said. "This deal embodies everything about the Washington establishment that frustrates the American people."
But even as Cruz spoke, he conceded defeat by accurately predicting the bill would pass "by a big margin," and accused his Senate colleagues of abandoning House Republicans in the fight against Obamacare.
"I ask you to imagine a world in which Senate Republicans united to support House Republicans," Cruz said. "It is heartbreaking to the American people that Senate Republicans divided as they did and decided to direct their criticism, direct their attention, direct their cannon fire at House Republicans and at those standing with the American people."
"They became the Air Force bombing our own troops -- bombing House Republicans, bombing conservatives," Cruz said.
McCain, one of Cruz's top GOP critics, countered later that the Texan's strategy is what did the damage to their party.
"The one thing that politicians want is approval from the people. They strongly disapprove of all of us -- they just disapprove of the Republicans more," McCain said. "So hopefully we learned the lesson not to do this. This is a hard blow to the Republican Party. We've got a real task ahead of us to dig ourselves out."
Coburn voted with Cruz, but nevertheless said he thought the fiasco had been entirely predictable because it was obvious Democrats and the president would never end Obamacare, and they control two of the three relevant parts of government. He had a tart piece of advice for Cruz and others: "Have a coordinated strategy that's based on reality rather than one that's not."
Obama promised to keep his pledge to negotiate once the crisis ended, and focused on the budget conference as the opportunity. "We now have an opportunity to focus on a sensible budget that is responsible, that is fair, and that helps hardworking people all across this country," he said.
Rep. Hal Rogers (R-Ky.), the House Appropriations Committee chair and a veteran lawmaker who has long bemoaned the abandonment of regular legislative procedures, sounded nearly as eager as Obama for the budget conference, which he has sought within his own conference.
"It's time to take the threat of default off the table," Rogers said before the measure passed in the House. "It's time to restore some sanity to this place, to do this we all have to give a little."
This article has been updated with the House vote and with Obama's signature.
ALSO ON HUFFPOST:
How will Trump’s administration impact you? Learn more