WASHINGTON — President Donald Trump said Thursday that he "probably" will declare a national emergency if he can't get Congress to agree to fund a wall along the U.S. border with Mexico.

"I'm not prepared to do that yet, but if I have to, I will," he told reporters on the South Lawn of the White House as he departed for a trip to McAllen, Texas, to see the border up close. "If this doesn't work out, probably I will do it. I would almost say definitely."

His fight with lawmakers over the $5.7 billion he wants for the wall led to a partial government shutdown Dec. 22 that remains in effect, with the White House and Congress at an impasse over whether even a single dollar should be spent on the barrier he promised to build on Mexico's dime during his 2016 campaign.

Trump walked out of a meeting with congressional leaders in the White House Situation Room Thursday after Speaker Nancy Pelosi, D-Calif., told him that Democrats would not agree to pay for the wall within 30 days if he consented to re-opening shuttered federal agencies.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Trump said Thursday that there are "various mechanisms" for circumventing Congress to get money for the wall and that White House lawyers have advised him that he has the authority to declare a national emergency. The most obvious pot of money is in the Pentagon's budget, which allows the secretary of Defense to transfer up to $4 billion between accounts under certain conditions.

But he said going around Congress isn't his preferred route.

"I would like to do the deal through Congress and because it makes sense to do it through Congress," he said. "The easy route for me would have been to call a national emergency to do it."

Pressed on why Mexico isn't paying for the wall — a staple promise of Trump's 2016 campaign — the president said he hadn't meant that literally.

"When, during the campaign, I would say Mexico’s going to pay for it, obviously, I never said this, and I never meant, they’re gonna write out a check," he said. "I said they’re gonna pay for it. They are. They are paying for it with the incredible deal we made called the United States Mexico and Canada, USMCA deal."

But Trump told the Washington Post in 2016 that Mexico could make a one-time payment for the wall, and economists have cast doubt on whether the trade deal — which is essentially an update of the old North America Free Trade Agreement — is likely to produce significant new revenue for the U.S. government.

Trump's visit to Texas comes two days after he delivered a primetime address to the nation on what he repeatedly referred to as a "crisis" on the border and one day after brief talks with congressional leaders over the wall and the shutdown ended with him saying "bye-bye" and exiting the room.

On Thursday, he disputed Senate Minority Leader Chuck Schumer's claim that he had slammed the table before departing Wednesday's meeting.

"I didn't pound on tables. I didn't raise my voice," Trump said. "That was a lie. ... Schumer always has his stand in line. 'He had a temper tantrum.' I don't have temper tantrums, I really don’t. But it plays to his narrative."

In retrospect, Trump said, maybe he should have displayed more anger.

"I didn't smash the table," he said. "I should have, but I didn't smash the table."