A government shutdown appeared likely after Congress deadlocked over a proposed four-week stopgap spending bill to keep federal offices open past Friday's deadline.
After the House late Thursday passed the measure, 230 to 197, with strong Republican support, the bill was headed for probable defeat in the Senate amid opposition from most Democrats and a few Republicans.
The setback sends the White House and congressional leaders back to the negotiating table in a frantic search for a compromise.
Democrats are rejecting the package because it lacks an immigration deal to protect so-called Dreamers from deportation.
Senate Majority Leader Mitch McConnell (R-Ky.) criticized Democrats for playing politics with the nation's stability and security. He said they were putting the needs of the young immigrants ahead the rest of the country.
"That's apparently how our Democratic colleagues rank their priorities," McConnell said. "It's not how I would rank mine."
But Sen. Charles E. Schumer (D-N.Y.), the Senate minority leader, blamed Republicans' internal divisions and a lack of leadership from the White House, particularly amid the president's shifting views in immigration talks.
"The leader is looking to deflect blame, but it just won't work," Schumer said. "We all know what the problem is: It's complete disarray on the Republican side."
Schumer called upon Congress to pass a short-term resolution to extend the funding deadline for two or three days to allow for some breathing space in which congressional leaders and the White House could try to arrive at a compromise.
But both sides were already working to blame each other for what would be the first shutdown since 2013, when Republicans closed the government in an unsuccessful bid to kill Obamacare.
House Republicans pushed through the stopgap spending bill Thursday evening, brushing off President Trump's last-minute ambiguity about the deal. After teetering most of the day, the measure won a pivotal endorsement from conservative lawmakers in the House Freedom Caucus.
Eleven House Republicans defied GOP leaders by joining most Democrats to oppose the bill. Six Democrats voted in favor.
But it seemed clear the bill lacked the needed support in the Senate, which began voting on the measure later Thursday night.
Among those GOP senators who said they wouldn't vote for the short-term measure were Sens. Lindsey Graham of South Carolina, who has been trying to negotiate an immigration deal, and Rand Paul of Kentucky. Other Republicans are thought to be on the fence, and Sen. John McCain of Arizona is not expected to vote because he has not returned to Washington since going home to battle brain cancer.
The current spending authority for government operations ends after midnight Friday. If not extended, hundreds of thousands of federal workers would be furloughed and many — but not all — government offices would be shut down.
GOP leaders had been racing to cobble together what would be their fourth short-term funding bill since last fall.
The proposed extension to Feb. 16 included six years of additional funding authorization for the Children's Health Insurance Program for working-class kids, a provision added to help attract Democratic votes.
But most Democrats panned the measure. House Minority Leader Nancy Pelosi (D-San Francisco) called the GOP bill a "bowl of doggy doo."
Democrats are angry that the GOP bill lacks protections for Dreamers, young immigrants brought to the country illegally by their parents. Trump has said he will end the Obama-era Deferred Action for Childhood Arrivals program, which offered the immigrants protection from deportation and work permits.
Though Trump has said he wants to help Dreamers, he is also trying to get funding for his border wall with Mexico along with other immigration law changes in return. Talks on immigration continued Thursday behind closed doors.
Trump and GOP leaders in Congress have worked hard to blame Democrats for any potential shutdown, but Pelosi said Republicans bear responsibility because they control the government.
"This is one of the only times ever there's been a shutdown when one party controlled the House, the Senate, the White House," she said, noting that Trump has previously said a shutdown might not be a bad thing. "It's really almost like an amateur hour."
Even some Republicans are unconvinced about the GOP plan, either because it does not include increased funding for the Pentagon or because they want to reduce government spending on principle. Others also want help for Dreamers or additional disaster aid for victims of the recent hurricanes and fires.
Republicans, with their slim 51-seat majority in the Senate, will probably need about a dozen Democrats to reach the 60 votes needed to overcome a filibuster, assuming some GOP senators object or miss the vote as expected.
Trump didn't help matters early Thursday when he suddenly tweeted against including the extension of the children's insurance program. In a tweet, Trump said funding for the program should be part of "a long term solution," not the stopgap measure.
Some speculated that perhaps the president was not aware that the CHIP funding would be extended for six years, rather than the four weeks of the spending bill. The president had similarly undermined a House vote last week reauthorizing a federal surveillance program until Ryan intervened and Trump reversed course.
By lunchtime, the administration tried to clarify the confusion, insisting that the president supports the current measure in the House. That was only after Ryan again spoke to the president by phone and the GOP whip, Sen. John Cornyn of Texas, tweeted a rebuttal.
"I've spoken with the president," Ryan told reporters. "He does understand."
In the final hour of negotiations before the House vote, Ryan met with the chairman of the Freedom Caucus, Rep. Mark Meadows (R-N.C.). Most of the group's members agreed to back the spending bill in exchange for future votes — including on a "conservative" immigration bill that would probably include even tougher border security and other provisions, aides said. They also won a promise for an eventual House vote on increased military spending.
In remarks at the Pentagon Thursday morning, Trump seemed resigned to a federal shutdown.
"It could happen," he said. "We'll see what happens. It's up to the Democrats."
Later in the day, as negotiations continued, Trump left Washington to attend a rally in Pennsylvania to offer his support for a GOP congressional candidate.
Trump and other Republicans stressed the negative impact a shutdown would have on the U.S. military.
But prospects in the Senate dimmed as leading Democrats — including some who supported the last stopgap measure — said they would withhold support without a resolution for Dreamers.
The top Democrat on the Appropriations Committee, Sen. Patrick J. Leahy of Vermont, said he would vote against the bill, as did the Virginia Democrats, Sen. Tim Kaine and Sen. Mark R. Warner, who represent large numbers of federal employees, and the New Mexico Democrats, Sens. Martin Heinrich and Tom Udall, who represent large numbers of immigrants and their advocates.
Senate Democrats are under great pressure from Dreamers to use their leverage to stop the bill and get an immigration deal.
Trump's tweeting Thursday also took aim at his own chief of staff, John F. Kelly, who has been trying to reach a compromise on the issue. Kelly told lawmakers Wednesday that Trump's border wall campaign promise was "uninformed" and that Mexico was unlikely to pay for it.
Kelly repeated his comments during a Fox News interview Wednesday night, saying Trump had "evolved" and changed his views on "a number of things" since entering the White House.
Politicians take campaign positions that "may or may not be fully informed" Kelly told Fox News on Wednesday night.
"Campaigning and governing are two different things and this president has been very, very flexible in terms of what is in the realm of the possible," Kelly said.
But Trump, in a note of discord with his top-ranking aide, denied he's "evolved" on building a wall across the U.S.-Mexico border.
"The Wall is the Wall, it has never changed or evolved from the first day I conceived of it," Trump wrote on Twitter. "Parts will be, of necessity, see through and it was never intended to be built in areas where there is natural protection such as mountains, wastelands or tough rivers or water."
6:30 p.m.: This article was updated after the Senate began voting on the measure.
4:50 p.m.: This article was updated with Ryan's quote.
4:38 p.m.: This article was updated after the House vote.
3:40 p.m.: This article was updated after the House Freedom Caucus said most of its members would support the measure.
1:25 p.m.: This article was updated with the vote prospects.
12:25 p.m.: This article has been updated with Ryan's intervention with Trump, Pelosi's statement and certain senators' planned votes.
12:05 p.m.: This article was updated with the White House statement.
8:40 a.m.: This article was updated with Trump's comments at the Pentagon.