WASHINGTON, Jan 10 (Reuters) - U.S. President Donald Trump on Thursday reiterated that he may declare a national emergency if Congress does not meet his demand for billions of dollars to construct a wall along the U.S.-Mexico frontier.

Trump was headed to McAllen, Texas, on the Mexican border in an attempt to win support for his wall a day after another acrimonious meeting with Democrats on funding for the barrier. A quarter of the federal government was shut down for the 20th day in the standoff.

Hundreds of thousands of federal employees are working without pay or staying home on furlough due to the shutdown, which will be the longest in U.S. history if still under way on Saturday. Trump is demanding that any legislation to end the partial closure must contain $5.7 billion for a border barrier.

As he prepared to leave the White House, Trump told reporters, "I have the absolute right to declare a national emergency. I'm not prepared to do that yet but if I have to I will ... I may do it. I this doesn't work out, probably I will do it. I would almost say definitely."

If he declares an emergency in an attempt to circumvent Congress's power over the national purse strings, Trump likely would try to redirect money from the Department of Defense toward his proposed wall. Democrats in control of the House of Representatives have refused to fund the wall as a part or shutdown-ending legislation.

Such a step likely would prompt an immediate legal challenge over constitutional powers from congressional Democrats. A subsequent court fight could be protracted, making room for the shutdown to be ended in the interim. The final outcome would then be left up to judges, not the president and Congress.

Critics say an emergency declaration would be illegal. Even some Republicans who want to build a wall have said they do not want money to taken from the military for it.

Trump's plan to build a wall at the southern border - and have Mexico pay for it - was a central promise of his 2016 presidential campaign. He said last month he would be "proud" to shut the government down over the issue but he has since tried to blame the Democrats.

Trump disparaged the top congressional Democrats, House Speaker Nancy Pelosi and Senate Democratic leader Chuck Schumer, by saying he finds China "to be far more honorable" and "easier to deal with."

Trump was being accompanied to Texas by the state's two U.S. senators, Republicans John Cornyn and Ted Cruz. After Trump's midday visit, Cornyn will host a roundtable discussion with area mayors, judges, law enforcement personnel and others involved with the border issue.

On Dec. 22, about 25 percent of the government - excluding mainly the Department of Defense and health-related programs - shut down because of Congress' inability to complete work by a September deadline on funding all government agencies.

Trump has said he will not sign any bill to reopen the government that does not provide wall funds.

The impasse has continued while Trump's meetings with Democratic congressional leaders have ended in acrimony. On Wednesday, he stormed out of a meeting with Pelosi and Schumer, calling it "a total waste of time."

Trump says undocumented immigrants and illegal drugs are streaming across the border from Mexico, despite statistics that show illegal immigration there is at a 20-year low and that many drug shipments likely are smuggled through legal ports of entry.

Democrats accuse Trump of using fear tactics and spreading misinformation about the border situation in order to fulfill a 2016 campaign promise as he looks toward his race for re-election in 2020.

The president has been working to make his case to the public, and bolster any congressional Republicans who might be wavering.

Pressure on them could intensify on Friday when about 800,000 federal employees - including border patrol agents and airport security screeners - miss their first paychecks.

On Tuesday, Trump said in his first prime-time television address from the Oval Office that there was a growing security and humanitarian crisis at the border.

Our global editorial team of more than 50 journalists and about 250 freelancers covers the world’s under-reported stories at the heart of aid, development, women’s and LGBT+ rights, human trafficking, property rights, and climate change.