President Trump called on Tuesday for shutting down the federal government if Congress does not crack down on illegal immigration, even as congressional negotiators closed in on a major budget deal that would set spending levels for two years and break the cycle of fiscal crises that has bedeviled the nation’s capital.
On Tuesday night, the House approved a stopgap spending bill that would increase military spending through September while keeping funds flowing to the rest of the government for six weeks. The House measure is unlikely to pass the Senate, where Democrats insist that an increase in military funds be matched with additional domestic spending.
But the House vote was a first step in what congressional leaders hoped would be a legislative dance that yields a bipartisan spending deal. Mr. Trump’s comments, though combative, had little to do with the delicate negotiations, a fact that appeared to elude Mr. Trump. They did, however, add a note of uncertainty.
“I’d love to see a shutdown if we don’t get this stuff taken care of,” Mr. Trump said at a meeting with lawmakers and law enforcement officials to discuss gang violence. “If we have to shut it down because the Democrats don’t want safety,” he added, “then shut it down.”
The two-year deal that congressional leaders want would raise statutory spending caps on military and nonmilitary spending through September 2019. That agreement would further balloon the budget deficit, but it would also ease the way to passing a temporary spending measure before the government shuts down on Friday. A longer-term spending deal could follow shortly thereafter.
“We are closer to an agreement than we have ever been,” Senator Chuck Schumer of New York, the Democratic leader, said, referring to the negotiations over raising the spending caps, which were imposed in 2011.
Republicans were similarly upbeat. “I’m optimistic that very soon we’ll be able to reach an agreement,” said Senator Mitch McConnell of Kentucky, the majority leader.
But if the bipartisan deal falls through, lawmakers have no clear plan to keep the government open past Thursday, with the parties disagreeing over spending priorities and the president lobbing verbal bombs from the White House.
“I would shut it down over this issue,” Mr. Trump said as he demanded an immigration deal on his terms. “If we don’t straighten out our border, we don’t have a country.”
Mr. Trump’s call for a shutdown was not the first time he had brandished the threat of closing down the government. He mused on Twitter last year that the country “needs a good ‘shutdown,’” a suggestion Democrats did not forget.
And on Tuesday, in a striking moment, a lawmaker from the president’s own party, Representative Barbara Comstock of Virginia, pushed back at the White House meeting.
“We don’t need a government shutdown on this,” said Ms. Comstock, a top Democratic target in the midterm elections. She represents a moderate district in Northern Virginia, an area that is home to many federal workers.
Soon after, Mr. Trump interrupted her. “You can say what you want,” he said. “We’re not getting support from the Democrats on this legislation.”
It has been less than three weeks since the last shutdown — a three-day closing that ended after Democrats won a promise from Mr. McConnell to have the Senate consider legislation to protect young immigrants who were brought to the United States illegally as children.
Mr. McConnell pledged that the Senate would turn to immigration if no deal had been reached on that subject by Thursday, when the current government funding measure is set to expire. This time, Senate Democrats have shown no appetite to force a shutdown.
But the fate of the young immigrants, known as Dreamers, remains highly uncertain, especially given Mr. Trump’s insistence that Democrats agree to build a wall on the Mexican border and enact other tough immigration policies.
The White House chief of staff, John F. Kelly, also took a hard line on immigration during a visit to the Capitol on Tuesday.
He said Mr. Trump was unlikely to extend a March 5 deadline, when the Obama-era program to protect Dreamers — Deferred Action for Childhood Arrivals, or DACA — is set to expire. And he said the president had been generous in his offer to give 1.8 million young undocumented immigrants a path to citizenship in exchange for a series of hard-line immigration policy changes.
“There are 690,000 official DACA registrants, and the president sent over what amounts to be two and a half times that number, to 1.8 million,” Mr. Kelly told reporters. “The difference between 690 and 1.8 million were the people that some would say were too afraid to sign up, others would say were too lazy to get off their asses, but they didn’t sign up.”
Neither party seemed to have any idea how the immigration debate would play out in the Senate in the days to come. Mr. McConnell has promised a free and open debate, with senators allowed to offer amendments to whatever measure is brought to the floor. But what the starting bill would look like remained a mystery.
“That’s the $64,000 question,” said Senator John Cornyn of Texas, the No. 2 Republican in the Senate. “Everybody wants to know, and Senator McConnell hasn’t told us.”
Mr. McConnell gave little hint of how the debate would proceed.
“In the Senate, on those rare occasions when we have these kind of open debates, whoever gets to 60 wins,” he told reporters. “And it’ll be an opportunity for 1,000 flowers to bloom.”
But with less than 72 hours remaining to avert a shutdown, congressional Republicans were moving on an entirely different track from the president, and immigration was not part of the equation as the House moved ahead with the stopgap spending bill.
The House voted 245 to 182 to approve the bill, with most Democrats voting against it.
House Republicans were hoping to pressure Senate Democrats to go along or face harsh political consequences. The bill would keep the government open through March 23.
“Quite literally the safety of our service members and the security of our country is at stake,” Speaker Paul D. Ryan of Wisconsin said.
But 44 members of the Senate Democratic caucus signed a letter in December opposing the House Republican approach. Passing the bill in the Senate will require 60 votes, meaning that those 44 Democrats, if they stick together, could block it.
“This is not a serious bill,” said Representative Nita M. Lowey of New York, the top Democrat on the House Appropriations Committee. “It is nothing more than a political ploy that will place us on the brink of another shutdown.”
If a deal on the spending caps is reached, lawmakers could approve legislation that includes that agreement along with a temporary measure to keep the government open. The package could also end up carrying other items as well, including disaster aid in response to last year’s hurricanes and perhaps an increase to the statutory limit on the government’s borrowing authority.