President Trump, as he left the White House Thursday for a visit to the U.S.-Mexico border, escalated his warnings that he could declare a national emergency to pursue his long-promised wall if he cannot reach a deal with Congress to fund border security and resolve the partial government shutdown.

The president told reporters on the White House lawn that he has an “absolute right” to declare a national emergency, as the government enters day 20 of the partial shutdown.

“I have the absolute right to declare a national emergency, the lawyers have so advised me,” Trump said. “I’m not prepared to do that yet, but if I have to, I will.”

He added: “If this doesn’t work out, probably, I will do it. I would almost say, definitely. This is a national emergency. ... If we don’t make a deal, I would say it would be very surprising to me that I would not declare a national emergency.”

The president repeatedly has threatened to declare an emergency and may use the visit to the border Thursday as part of his decision-making process. The National Emergencies Act grants the president broad authority to declare emergencies, though such a declaration would almost certainly face legal challenges.

But the president maintained he would rather come to an agreement with Democrats -- despite a meeting with Democrats a day earlier ending abruptly when he walked out upon House Speaker Nancy Pelosi's refusal to support wall funding.

“Either we’ll win or make a compromise. I’m okay to make a compromise—compromise is in my vocabulary very strongly,” Trump said. “I think a compromise is a win for everybody, otherwise, I can declare a national emergency.”

TRUMP SAYS HE HAS 'ABSOLUTE RIGHT' TO DECLARE NATIONAL EMERGENCY OVER BORDER SECURITY 

He went on to say Democrats have been “taken over by a group of young people, some of them, I’ve been watching, I actually think they’re crazy.” Apparently referencing freshman Democratic lawmakers who have been vocal about their progressive policy goals, he said, “They have been taken over by a group of people that don’t care about gangs, human trafficking and drugs. They don’t care about anything. I’ll tell you what, they have gone crazy.”

Meanwhile, Trump has continued to face criticism for going to Congress for money to construct a border wall, even though he repeatedly promised during his 2016 presidential campaign that Mexico would pay for it.

Addressing that controversy on Thursday, he said: "I never meant they were going to write a check. ... When I said Mexico will pay for the wall in front of thousands and thousands of people, obviously they're not going to write a check."

Instead, Trump claimed that through the new United States-Mexico-Canada Agreement (USMCA), which he called "incredible," Mexico would "indirectly pay for the wall." The deal, though, has not been passed in Congress.

The president’s comments came as he departed the White House for a trip to the border with Homeland Security Secretary Kirstjen Nielsen, acting White House Chief of Staff Mick Mulvaney and senior adviser and son-in-law Jared Kushner.

Democrats decried the trip.

“This isn’t leadership; it’s chaos," Democratic National Commitee Chairman Tom Perez said in a statement. "800,000 workers remain furloughed or working without pay ... The American people are demanding an end to the Trump Shutdown. The House has already passed bipartisan legislation to end the Trump Shutdown, and Democrats are ready to pass legislation to fund common-sense, effective border security. The president should cancel his publicity stunt, stay in Washington, and end the shutdown crisis he created.”

The government partially ran out of funding on Dec. 22, forcing hundreds of thousands of federal workers and contractors to work without pay, or simply stay home. Since then, Republicans and Democrats have been in a stalemate over border security. The president requested $5.7 billion to build the wall along the U.S.-Mexico border, but Democrats have vowed to block the request.

Last week, House Democrats passed a bill to fund the Department of Homeland Security, which oversees construction of the wall, at current levels through Feb. 8, with a $1.3 billion for border security—a figure far less than Trump requested. Senate Republicans, so far, have not taken it up.

TRUMP SET TO VISIT SOUTHERN BORDER IN TEXAS, AS FEDERAL SHUTDOWN CONTINUES

Trump and administration officials have had several meetings with Democrats in recent days.  On Wednesday, Trump walked out of the meeting with Pelosi and Senate Minority Leader Chuck Schumer, D-N.Y., who said Trump had a “temper tantrum.”

Trump rejected the account, while acknowledging he walked out. He tweeted Thursday morning that “Cryin’ Chuck” Schumer “told his favorite lie when he used his standard sound bite that I ‘slammed the table & walked out of the room. He had a temper tantrum.’ Because I knew he would say that, and after Nancy said no to proper border security, I politely said bye-bye and left, no slamming!”

CLICK HERE TO GET THE FOX NEWS APP

He told reporters on Thursday: “I didn’t have a temper tantrum, I didn’t smash the table. … I should have.”

Fox News’ John Roberts and Gregg Re contributed to this report.