(CNN) President Donald Trump said he is nearing a decision to declare a national emergency on the southern border , which he visited in person Thursday despite earlier reservations about taking the trip.

The President warned as he departed the White House he would take the step -- which would be subject to immediate legal challenge -- if talks with Democrats continue to crumble. Trump stormed out of a meeting with Democratic leaders a day earlier, insisting they weren't ready to deal.

The standoff has prompted a partial government shutdown that has now stretched 20 days. Many federal workers will miss their first paychecks on Friday.

"If this doesn't work out, probably I will do it, I would almost say definitely," Trump said. "This is a national emergency."

Inching closer to using executive authority allowing him to repurpose federal funds for a border wall without congressional approval, Trump said his lawyers have advised him he's within his rights to take the step. And he suggested there are alternate methods of securing funds outside of new legislation.

"If we don't make a deal, I would say 100%. I don't want to say 100% because maybe something else comes up," he said. "But 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 and just fund it through the various mechanisms."

Trump was departing for McAllen, Texas, a border town where he hoped to highlight the need for increased border security and a physical barrier, which was a central promise of his campaign. Earlier in the week, Trump cast doubt on the necessity of the trip, believing it would not change the negotiating dynamics. But advisers have pressed him to scale up his messaging, including the primetime Oval Office address he delivered on Tuesday.

In an interview later on Thursday with Fox News host Sean Hannity, Trump said his decision on whether to declare a national emergency hinges on the events of the upcoming days, his most definitive statement yet on when an emergency could come.

"I think we're going to see what happens over the next few days," Trump told Hannity. "They should do it immediately. Look, we're not going anywhere, we're not changing our mind because there's nothing to change our mind about. The wall works. ... It'll work 100%."

Border visit

In Texas, Trump participated in a roundtable on immigration and border security at the US Border Patrol McAllen Station, hearing from law enforcement officers and others who told him they supported his mission to construct a wall.

Later he traveled to the border itself along the Rio Grande River before returning to Washington later in the evening.

"We need security. We need the kind of backup they want," Trump said, surrounded by border patrol agents at a stretch of the border.

He claimed to have the political upper hand, saying Schumer and Pelosi were weakened.

"They're not winning this argument. They're losing the argument badly," he said.

Before he departed, White House aides said it was increasingly likely Trump could declare a national emergency in order to fund his wall and end the funding standoff. If he finds alternative ways to fund the project, Trump would sign spending bills opening the shuttered federal agencies, the officials said.

Talks with Democrats stalled Wednesday after House Speaker Nancy Pelosi told the President she would not support building a barrier structure on the US-Mexico border. The meeting, held in the White House Situation Room, ended abruptly when Trump walked out, bidding the Democrats "bye-bye."

Afterward, Pelosi and Senate Democratic Leader Chuck Schumer described a fuming Trump, slamming his hands on the table before storming out. But the President said that was a mischaracterization, insisting Thursday he "very calmly walked out of the room."

"I didn't pound on the table, I didn't raise my voice. That was a lie. What you should do is give them pinocchios," Trump said on the South Lawn. "I very calmly said if you're not going to give us strong borders, bye-bye, and I left. I didn't rant. I didn't rave, like you reported."

"I don't have temper tantrums. I really don't," Trump went on. "I very calmly walked out of the room. I didn't smash the table. I should have. But I didn't smash the table."

Still, the President offered little indication he was prepared to back down from his demand of more than $5 billion for the border wall construction, leaving few signs a deal will be struck in the near term with Democrats to reopen government. With talks at even more of a stalemate, officials inside the administration increasingly feel like an emergency declaration is one of few options.

Emergency declaration

In an unusual move, Pat Cipollone, the White House counsel, was originally scheduled to travel with the President to the southern border Thursday, according to officials. However, he did not ultimately make the trip with Trump.

Trump is not expected to declare a national emergency while there, though people close to the President caution that could change. There has been serious debate internally about the legal ramifications of Trump declaring a national emergency so he can build his border wall without congressional approval.

While it's not certain Trump will declare an emergency, the White House likes being able to hold the card over Democrats who they say have refused to compromise or even negotiate, the officials said.

Even some of Trump's closest allies and aides who feel they've "won" the shutdown messaging so far say they believe momentum could shift starting Friday, when hundreds of thousands of federal workers won't receive their paychecks. Matters could only get worse on Saturday, when news outlets and television networks will be able to declare this the longest continuous shutdown in US history.

As Trump makes his pitch for a barrier on the southern border, he acknowledged the Texas trip is simply for publicity.

"It's not going to change a damn thing, but I'm still doing it," Trump said of the border visit during a meeting between the President and network anchors Tuesday afternoon.

Trump referenced his advisers Bill Shine, Kellyanne Conway and White House press secretary Sarah Sanders, who were all in the room during the off-the-record meeting, first reported by the New York Times, and said they convinced him the trip would be "worth it."