Updated at 9:05 p.m. ET
President Trump has signed a stopgap spending bill passed by Congress on Monday, ending the partial shutdown of the federal government after three days.
The White House has said normal government operations will resume by Tuesday morning.
The bill passed the Senate on Monday afternoon with a 81-18 vote, but the real hurdle was the procedural vote earlier in the day requiring at least 60 votes. That's where the measure hit a snafu late Friday night, triggering the stalemate. The House later passed the 17-day extension by a 266-150 vote.
Shortly before the Monday procedural vote was set to begin, Senate Minority Leader Chuck Schumer, D-N.Y., announced that he would vote to reopen the government along with enough Democrats needed to advance the bill. After 24 hours of furious negotiation over plans to consider immigration legislation in the coming weeks, the Senate voted to move forward with the continuing resolution, which would fund the government through Feb. 8.
In exchange for his support, Schumer said, he has received assurances from Senate Majority Leader Mitch McConnell, R-Ky., that if an agreement isn't reached by then, the GOP leader will bring a vote to the floor on legislation to grant legal status to those protected under the Deferred Action for Childhood Arrivals program, roughly 700,000 immigrants who are in the country illegally after being brought here as children. The bill also extends the expired Children's Health Insurance Program for six years.
McConnell says Democrats caved because they realized holding out for a DACA deal tied to the funding deal was not wise politically.
"I think if we've learned anything during this process it's that a strategy to shut down the government over the issue of illegal immigration is something that the American people didn't understand," McConnell said.
Schumer, however, argued that blame for the weekend-long stalemate lay at the president's feet.
"The reason the Republican majority had such difficulty finding consensus is they could never get a firm grip on what the president of their party wanted to do. These days, you never know who to deal with when it comes to the Republicans," Schumer said. "The Republican leaders told me to work out a deal with the White House. The White House said, work it out with Republican leaders on the Hill. Separately, President Trump turned away from not one, but two bipartisan compromises. Each would have avoided this shutdown."
In statement later Monday, Trump said that with the government on the path to reopening, the administration would work on immigration legislation — but "only if it's good for our country."
"I am pleased that Democrats in Congress have come to their senses and are now willing to fund our great military, border patrol, first responders and insurance for vulnerable children," Trump said. "As I've always said, once the government is funded, my administration will work towards solving the problem of very unfair illegal immigration. We will make a long-term deal on immigration if and only if it's good for our country."
White House press secretary Sarah Huckabee Sanders dodged questions at the daily briefing as to whether that would include a path to citizenship for DACA recipients, which many hard-line conservatives oppose. And she insisted that the president has been clear about what he wants in an immigration bill, despite shifting positions over the past week that even GOP leaders have complained about.
With the measure moving forward, it will now be hard for Democrats to argue they extracted many concessions from GOP leaders. McConnell's promise is just that — a promise. "Some of us struggle to trust him," Sen. Chris Coons, D-Del., told NPR's Morning Edition, "because of the famously vulgar way that President Trump sort of blew up the last time that Sens. [Lindsey] Graham and [Dick] Durbin offered him a bipartisan deal [on immigration]."
Democrats were trying to frame the deal as a temporary victory, though. Senate Minority Whip Durbin took the floor to call the DACA issue the "civil rights issue of our time" and underscore the importance of passing an immigration bill by the new deadline, which he said McConnell had assured them would be on a level playing field.
While many Senate Democrats had remained entrenched in their opposition to any funding deal that didn't include a DACA fix, a growing number of moderate lawmakers were wary of an extended shutdown fight. Most of the endangered Democrats who are up for re-election in 2018 in states that Trump won all voted to advance the measure, except for Montana Sen. Jon Tester.
Sen. Bill Nelson, D-Fla., who faces a potentially competitive re-election this fall, sounded optimistic about the agreement.
"What you have is pretty much an ironclad commitment that if we don't resolve this — and that's what we're going to try to do with the Graham bill — resolve the DACA issue by Feb. 8, the commitment is you go to the floor with a neutral bill, like a shell, and you let the Senate process work," Nelson said.
Many Democrats had worried that the Republican talking point that Democrats were siding with "illegal immigrants" over the military and government would resonate with voters as the stalemate extended into the workweek Monday morning.
President Trump tweeted that argument himself.
Sen. Tom Cotton, R-Ark., who has argued for tougher immigration standards, also echoed that sentiment.
"Shutting down the government and depriving American citizens of services because you want amnesty for illegal immigrants is a massive political blunder," said Cotton.
Trump has generally kept a low profile during the shutdown. He canceled a planned trip to Florida where he hoped to celebrate the first anniversary of his inauguration with a high-dollar fundraising party.
Aides say the president spent the weekend telephoning lawmakers and working with staff to minimize fallout from shuttered government operations.
Sanders pushed back on allegations from Schumer and other Democrats that Trump was absent from negotiations over the weekend and never reached out to their side. "What the president did clearly worked," Sanders countered. "The vote just came in 81-18."
A group of about 20 senators met for several hours on Saturday and again on Sunday afternoon to hash out the plan that ultimately allowed both sides to back down from their increasingly entrenched positions and vote to reopen the government.
Representatives from those talks briefed leaders Sunday afternoon, but the suspense dragged out for nearly six hours before McConnell made his announcement.
Several of the senators in the bipartisan group said they worried a prolonged shutdown could become harder to fix and would cause greater damage to the country.
Sen. Heidi Heitkamp, D-N.D., who is one of several Democrats up for re-election in states where Trump won in 2016, joined the talks. "One of the things we learned from the last shutdown was that as time goes on, positions harden," Heitkamp said. "Resolution gets more difficult the longer we wait."
However, more liberal senators — including several potential 2020 hopefuls such as Cory Booker of New Jersey, Kirsten Gillibrand of New York, Kamala Harris of California and Bernie Sanders of Vermont — all voted against the measure, standing firm over the DACA issue.
Two conservative GOP senators, Mike Lee of Utah and Rand Paul of Kentucky, also voted no, though they have repeatedly opposed on principle any continuing resolutions as a way to keep the government funded.
NPR White House correspondent Scott Horsley and NPR congressional correspondent Susan Davis contributed to this report.