WASHINGTON — President Donald Trump threatened on Thursday to declare a national emergency to circumvent Congress if he can’t reach a deal with Democrats to fund his promised border wall. He headed to the U.S.-Mexico border to draw further attention to his case after negotiations with lawmakers blew up.

The partial government shutdown dragged into a 20th day with hundreds of thousands of federal workers off the job or working without pay as the wall fight persisted.

Asked about a national emergency declaration, Trump said as he left the White House for Texas, “I’m not prepared to do that yet, but if I have to I will.” He contends such a declaration would allow him to direct the military to begin wall construction.

“So we’re either going to have a win, make a compromise —because I think a compromise is a win for everybody— or I will declare a national emergency,” he said.

It’s not clear what a compromise might entail. Trump says he won’t reopen the government without money for the wall. Democrats say they favor measures to bolster border security but oppose the long, impregnable walling that Trump envisions. He is asking $5.7 billion for wall construction.

Trump’s comments came a day after he walked out of a negotiating meeting with congressional leaders — “I said bye-bye,” he tweeted soon after — as efforts to end the partial government shutdown fell into deeper disarray. Affected federal workers face lost paychecks on Friday, and more people are touched every day by the rollback of government services.

Putting the standoff in personal terms, the president tweeted before leaving for Texas: “The Opposition Party & the Dems know we must have Strong Border Security, but don’t want to give ‘Trump’ another one of many wins!”

In McAllen, Texas, Trump will visit a border patrol station for a roundtable discussion on immigration and border security and will get a briefing. But he has expressed his own doubts that his appearance and remarks will change any minds as he seeks money for the wall that has been his signature promise since his presidential campaign.