President Trump said Tuesday he would "love" to see a government shutdown if Democrats do not agree to his demands on immigration.

"We'll do a shutdown and it's worth it for our country. I'd love to see a shutdown if we don't get this stuff taken care of," Trump told law enforcement officials and members of Congress at the White House.

During impromptu remarks at an event on immigration, Trump said Democrats must accept new border-security measures to keep out people trying to enter the country illegally.

"If we have to shut it down because the Democrats don't want safety and, unrelated but still related, they don't want to take care of our military, then shut it down," the president added. "We'll go with another shutdown."

Trump's saber rattling came as lawmakers are rushing to meet a Thursday deadline to fund the government.

His tough talk stands in stark contrast to optimism on Capitol Hill about the chances of averting a shutdown.

Republican and Democratic leaders in the Senate announced earlier Tuesday they were close to a two-year budget deal, which does not include immigration language.

"Speaks for itself," Senate Minority Leader Charles Schumer (D-N.Y.) said when asked to respond to Trump's comments.

"We had one Trump shutdown. Nobody wants another, maybe except him."

Rep. Barbara Comstock (Va.), a vulnerable Republican who represents a district outside of Washington, D.C., with many federal workers, rebuked Trump after he welcomed a shutdown.

"We don't need a government shutdown on this," she told Trump during the meeting. "I think both sides have learned that a government shutdown is bad."

Comstock said there is bipartisan support for cracking down on violent gangs such as MS-13, which was the focus of Tuesday's meeting.

Trump cut off the Virginia lawmaker and doubled down on his willingness to stage a shutdown.

"We have to get that, they are not supporting us," the president said. "You can say what you want. We are not getting support of the Democrats."

Trump has vented his frustration that Democrats have refused to accept his sweeping immigration plan. The proposal would offer a path to citizenship for as many as 1.8 million immigrants who came to the U.S. illegally as children in exchange for billions of dollars for a wall along the southern border and steep cuts to legal immigration.

Democrats and some Republicans have objected to making significant to changes to the U.S. visa system, while conservative GOP lawmakers have balked at a citizenship path.

Trump has framed the offer as Congress's best chance to save the Deferred Action for Childhood Arrivals program, which he scrapped last year.

While the president in the past has floated the possibility of extending the March 5 deadline to end the program for young immigrants, White House chief of staff John Kelly on Tuesday poured cold water on that idea.

If lawmakers do not agree to an immigration deal before Thursday's government funding deadline, Senate Majority Leader Mitch McConnell (R-Ky.) has said he would hold an open debate on the issue.

- This report was updated at 3:45 p.m.