Updated at 7:05 p.m. ET
President Trump has endorsed a bipartisan deal that would end the 35-day partial government shutdown. The three-week stopgap funding measure would reopen shuttered agencies while negotiations continue.
"I am very proud to announce today that we have reached a deal to end the shutdown and reopen the federal government," Trump said in the White House Rose Garden.
By Friday evening, the House and Senate unanimously passed the bill to fund the government through Feb. 15. Both chambers also authorized moving forward on a longer-term Department of Homeland Security funding bill for the rest of the fiscal year, where border security funds can be negotiated on a bipartisan basis. The bills now heads to Trump's desk.
The president's signature would bring to a close the longest government shutdown in history. The question remains, however, what Trump exactly accomplished with his firm stance against any deal without funding for a border wall, which he eventually capitulated to.
The proposal backed by congressional leaders does not include funding for the wall along the U.S.-Mexico border that Trump has pushed for, and the Homeland Security bill would not include money earmarked for a wall, either.
Ultimately, as the president's approval ratings tumbled and polls showed the public largely blamed Republicans for the increasingly dire situation — punctuated on Friday by massive delays at major airports and recent warnings about a threat to national security — Trump finally seemed to back down from his demands. At least for now.
Another shutdown looming in three weeks?
Trump seemed to revive earlier deal-breakers as he ended his speech, warning that if negotiations over the next three weeks don't result in funding for the "powerful wall or steel barrier" he has demanded, "the government would either shut down again" or he would declare a national emergency to build the wall.
"I have a very powerful alternative, but I didn't want to use it at this time. Hopefully it will be unnecessary," Trump teased at the beginning of his remarks about the extreme measures — which would very likely face legal challenges in court.
"We do not need 2,000 miles of concrete wall from sea to shiny sea," the president added, showing an openness to some technology efforts that some Democrats have signaled they could back. Still, he reiterated proposals to build barriers in specific areas identified by the Border Patrol, strengthen security at legal ports of entry and provide humanitarian assistance to those who have crossed the border.
"Walls or barriers or whatever you want to call it will be an important part of the solution," said Trump, who has regularly contradicted himself in how he describes the promised wall.
The president's remarks soon veered into his standard stump speech on the dangers of illegal immigration — but many of those claims have been fact-checked in the past to be misleading or exaggerated.
Democrats take a victory lap
Trump and Republicans had long maintained any deal to end the shutdown must include funding for the border wall the president wants, which was his key promise during the 2016 campaign. But Democrats said they should reopen the government and then resume talks, which is exactly what Friday's deal does.
Democratic leaders argued their conference's unity is what eventually caused Trump to cave.
"The American people do not like it when you throw a wrench into the lives of government workers over an unrelated political dispute," Senate Minority Leader Chuck Schumer, D-N.Y., told reporters. "Hopefully now the president has learned his lesson."
The first signs of a crack in Trump's resolve came earlier this week. After Pelosi said he could not give the State of the Union address until after the shutdown, Trump threatened to hold the annual speech someplace else. But he backed down hours later and said he would defer to Pelosi.
It's unclear when the State of the Union, which had been slated for next Tuesday, will happen following Friday's deal to end the shutdown. Pelosi told reporters that it is "not planned now," and that she had told Trump "when the government is opened we will discuss a mutually agreeable date."
Pelosi, a veteran appropriator, said she was hopeful the three-week talks would produce a deal on border security, though she didn't answer a question about whether that may include any funding for even portions of a wall. She has repeatedly said she is opposed to a wall and has called it "immoral."
"I see every challenge or every crisis as an opportunity," Pelosi said.
Speaking on the Senate floor shortly after Trump endorsed the deal, McConnell said he too was optimistic, but with some caveats.
"Going forward, I hope Democrats will stay true to the commitment they have stated constantly over the past weeks — that once government was reopened, they would be perfectly willing to negotiate in good faith on full-year government funding that would include a significant investment in urgently needed border security measures, including physical barriers," McConnell said.
Consequences of the prolonged shutdown
Federal employees who have been working without pay or are furloughed would also get back pay as part of the agreement, though it's unclear how long that might take.
The American Federation of Government Employees says workers could get back pay as soon as next Thursday, but the union says it is also possible they won't get paid until their next scheduled pay date during the week of Feb. 4.
A senior administration official says "the administration is taking steps to ensure that they receive pay as soon as possible."
Federal contractors also impacted by the shutdown would not get any back pay.
The breakthrough comes as federal workers missed their second paycheck in a row, now going without their salaries for more than a month. Trump thanked those workers, calling them "patriots" and said they have "suffered" far greater than anyone but they and their families can understand.
The prolonged stalemate has pushed the nation's security and infrastructure to the brink, with significant flight delays at major airports due to Federal Aviation Administration and Transportation Security Administration absences escalating on Friday. The FBI has also warned that critical crime-fighting measures have been curtailed with its agents limited and working without pay.
On Thursday, Sen. Lindsey Graham, R-S.C., a Trump ally who has also pushed for major changes to the nation's immigration laws, wrote on Twitter that he was working on a short-term, three-week funding bill "that includes a down payment on wall/barrier funding and Democratic priorities for disaster relief showing good faith from both sides." But Democrats said that would be another non-starter.
Trump signaled Thursday he might be open to a compromise, after his proposal to reopen the government with full funding for his border wall failed in the Senate. His plan would have included border wall funding in exchange for three years of legal status and other protections for those affected by the Deferred Action for Childhood Arrivals program and those with temporary protected status.
A competing plan backed by Democrats also failed to pass on Thursday. That proposal would have been a short-term funding measure through Feb. 8 with additional disaster aid but no money for the wall. Though it failed, more members voted for the Democrats' proposal in the GOP-controlled Senate than for Trump's plan.
McConnell and Schumer continued negotiations after the votes on Thursday, and Trump told reporters Thursday he could approve of a possible deal if the two leaders reached one.
"It depends on what the agreement is," Trump said. "If they come to a reasonable agreement I would support it."
The shutdown began on Dec. 22, when Republicans still had control of a lame duck Congress following their loss of 40 seats in the House in November 2018.
After two years of unified control, the GOP president was unable to push through Trump's signature campaign promise — which he repeatedly said during the 2016 campaign that Mexico would pay for — and there seemed to be an urgency to his last push. Egged on by conservative media and pundits, Trump drew a line — until he didn't.
Schumer said the lesson Trump should take away from quagmire is that Pelosi, who reclaimed the speaker's gavel at the beginning of January, should not be taken lightly.
"No one should ever underestimate the speaker, as Donald Trump has learned," Schumer said.
NPR congressional correspondents Susan Davis, Kelsey Snell and NPR national security correspondent Greg Myre contributed to this report.