President Donald Trump listens Tuesday at a White House meeting on border security and the MS-13 street gang. Afterward, he repeated his threat of a shutdown unless Congress provides funding for a border wall.

WASHINGTON -- President Donald Trump revived his threat Tuesday to shut down the federal government if Congress cannot agree to a spending deal that tightens the nation's immigration laws.

"I'd love to see a shutdown if we can't get this stuff taken care of," Trump said to reporters after a meeting with law enforcement officials to discuss gang-related violence. "If we have to shut it down because the Democrats don't want safety," he added, "let's shut it down."

But some progress was made Tuesday on Capitol Hill, with the House passing a short-term spending measure Tuesday night and with Senate leaders saying they were closing in on a larger, long-term pact ahead of a Thursday night deadline.

The Republican and Democratic leaders in the Senate said earlier in the day that they were nearing a deal to raise statutory spending caps on military and nonmilitary spending. That deal was seen as possibly securing a major, two-year spending bill before the government is set to shut down Friday, sparing the country another of the fiscal showdowns that have continued to bedevil the government.

[U.S. immigration: Data visualization of selected immigration statistics, U.S. border map]

Trump's remarks marked the second time in his presidency that he has brandished the threat of a government shutdown unless Congress agrees to finance the building of a border wall with Mexico. He also did it in May, suggesting that the United States could use a "good shutdown" to force a partisan confrontation over federal spending.

It has been nearly three weeks since the last shutdown -- a three-day closure that ended after Democrats won a promise from Senate Majority Leader Mitch McConnell, R-Ky., to negotiate a deal on people who came to the U.S. as children but who now live here illegally.

Trump railed against the Democrats during that shutdown.

"Democrats are far more concerned with Illegal immigrants than they are with our great Military or Safety at our dangerous Southern Border," he wrote on Twitter last month. "They could easily have made a deal but decided to play shutdown politics instead."

[PRESIDENT TRUMP: Timeline, appointments, executive orders + guide to actions in first year]

Rep. Barbara Comstock, a Republican from a swing district in Virginia, responded: "We don't need a government shutdown on this."

White House Chief of Staff John Kelly also took a hard line on immigration during a visit to the Capitol. He said Tuesday that Trump is unlikely to extend a March 5 deadline for when the Deferred Action for Childhood Arrivals program, established under former President Barack Obama, is set to expire. And he again said the president has been more than generous in his offer to give 1.8 million young illegal aliens 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 2½ times that number, to 1.8 million," he told reporters at the Capitol, referring to the deferred-action program by its initials. "The difference between [690,000] 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 a**es."

MILITARY FUNDING

With less than 72 hours remaining to avert a shutdown, lawmakers were moving on a different track from the president, advocating for a short-term spending bill that included a full year of funding for the military. Immigration was not part of the equation.

The stopgap spending bill, which passed 245-182 in the House, would keep the government open through March 23 to allow time to write and pass detailed follow-up "omnibus" legislation to fund the government through the Sept. 30 end of the fiscal year.

The prospective longer-term budget agreement would give both the Pentagon and domestic agencies relief from a budget freeze that lawmakers say threatens military readiness and training as well as domestic priorities such as combating opioid abuse and repairing the government's troubled health care system for veterans.

The stopgap bill appears increasingly likely to be rewritten in the Senate to include legislation implementing the brewing broader budget pact, and to account for Democrats who are holding out for a matching increase in nondefense spending.

"Democrats have made our position in these negotiations very clear," Minority Leader Charles Schumer, D-N.Y., said on the Senate floor Tuesday. "We support an increase in funding for our military and our middle class. The two are not mutually exclusive. We don't want to do just one and leave the other behind."

Schumer paid a visit to McConnell's office Tuesday morning. After the session, Schumer, refusing to elaborate, told reporters that it was a "good meeting." McConnell added: "We're on the way to getting an agreement and on the way to getting an agreement very soon."

Congress so far has needed four temporary spending bills in four months to fund the government in fiscal 2018. The stopgap bill that is needed by the end of Thursday, when the current measure expires, would be the fifth.

"As Democrats have said for many months, this is a perversion of good government and the polar opposite of regular order," said Rep. Nita Lowey of New York, the top Democrat on the House Appropriations Committee. "It is a truly shameful display of incompetence."

Aides in both parties said the prospective longer-term budget deal may contain a provision to raise the government's $20.5 trillion borrowing cap. Legislation to increase the debt ceiling is always a headache, especially for House GOP leaders whose rank and file hate such votes. Schumer said that addressing the debt ceiling is an option for now but not a sure thing.

The negotiations have been delicate. Hard-line conservatives in the House do not want to vote for any more stopgap spending bills that do not include the increase in military spending. But spending bills need Democratic support in the Senate to overcome a filibuster, and Democratic senators have insisted that they will not support the increase in military spending without the increase in domestic spending.

House Democrats, meanwhile, have stated their opposition to any measure that doesn't protect from deportation the young illegal aliens brought to the country as children.

But negotiations on the fate of such aliens are stuck. Trump again took to Twitter on Tuesday to demand that any immigration deal include severely curtailed "chain migration," the current immigration system that allows immigrants who become citizens or green-card holders to then sponsor family members. Instead, he wants to favor highly skilled applicants in a "merit-based" system.

AFGHAN WAR COST: $45B

While the debate over military spending continued, the Pentagon announced Tuesday that the Afghan war is costing American taxpayers $45 billion each year.

Lawmakers, skeptical about the prospects of victory, grilled the Trump administration Tuesday on the direction of the nation's longest-running war, now in its 17th year. The Senate Foreign Relations Committee hearing occurred after a wave of militant attacks in Kabul that killed more than 200 people.

Randall Schriver, the Defense Department's top Asia official, said the $45 billion total for the year includes $5 billion for Afghan forces and $13 billion for U.S. forces inside Afghanistan. Much of the rest is for logistical support. Some $780 million goes toward economic aid.

The costs now are still significantly lower than during the high point of the war in Afghanistan. From 2010 to 2012, when the U.S. had as many as 100,000 soldiers in the country, the price for American taxpayers surpassed $100 billion each year. There are currently about 16,000 U.S. troops in Afghanistan.

Both Republican and Democratic senators highlighted the scale of the continuing outlay from Washington. Six months ago, Trump unveiled his strategy for turning the tide in the war, setting no time limit on the U.S. military's involvement in the war-battered country, saying it would be based on conditions on the ground.

Tens of billions of dollars are "just being thrown down a hatch in Afghanistan," said Sen. Rand Paul, R-Ky. "We're in an impossible situation. I see no hope for it."

Sen. Ed Markey, D-Mass., suggested that those funds could be more effectively spent in saving American lives by investing in treatment for those suffering from opioid abuse. He cited research that two months of Afghan spending could fund an opioid center in every county in the United States.

Separately, Defense Secretary James Mattis defended the decision to keep U.S. forces in Afghanistan, saying it was to prevent "another 9/11" being hatched from there. He told the House Armed Services Committee that the U.S. regional strategy "puts the enemy on the path toward accepting reconciliation."

Information for this article was contributed by Mark Landler and Thomas Kaplan of The New York Times; by Andrew Taylor, Matthew Pennington, Richard Lardner and Robert Burns of The Associated Press; and by Mike DeBonis, Erica Werner, Amy Goldstein and Paul Sonne of The Washington Post.

Photo by The New York Times/ERIN SCHAFF

Senate Minority Leader Charles Schumer speaks at a news conference Tuesday, along with Democratic Senate colleagues. Schumer met earlier Tuesday with Senate Majority Leader Mitch McConnell, who said that “we’re on the way to getting an agreement” on a spending bill.

Photo by AP/EVAN VUCCI

White House Chief of Staff John Kelly attends a White House meeting Tuesday on border security and gang activity. During a visit to the Capitol, Kelly took a hard line on immigration and argued that some people would say eligible illegal aliens were too afraid or “too lazy” to sign up for the Deferred Action for Childhood Arrivals program.

RELATED ARTICLE Expanding deficits pose threat to U.S., budget office warns

A Section on 02/07/2018