MCALLEN, Texas/WASHINGTON (Reuters) - Flanked by border agents who are going without paychecks during a government shutdown, U.S. President Donald Trump threatened on Thursday to use emergency powers to bypass Congress to pay for a wall on the U.S.-Mexico border.

Trump flew to the Texas border with Mexico to try to bolster his case for the border wall as a partial U.S. government shutdown tied to the issue stretched into its 20th day with no sign of new talks to resolve the impasse.

“We can declare a national emergency. We shouldn’t have to,” Trump told reporters. “This is just common sense.”

Such a step would likely prompt an immediate legal challenge over constitutional powers from congressional Democrats - a challenge Trump said he would win.

The Republican president is adamant that a government funding bill to end the shutdown include $5.7 billion for a border barrier - his signature campaign promise. Congressional Democrats oppose that.

The standoff has left a quarter of the federal government closed down and hundreds of thousands of federal employees without pay.

A day after he stormed out of a meeting with Democratic leaders, Trump attacked them for refusing his demand, calling them harder to deal with than China, a rival power.

“I find China, frankly, in many ways to be far more honorable than Crying Chuck and Nancy. I really do,” Trump said, referring to House of Representatives Speaker Nancy Pelosi and Senate Democratic leader Chuck Schumer.

The House passed two bills to fund the departments of transportation, housing and agriculture - each drawing a few more Republican votes than a similar effort on Wednesday to reopen the Treasury Department and other agencies.

The White House has said Trump would veto the bills if they made it to his desk.

Trump canceled plans to attend the World Economic Forum in Davos, Switzerland, which is scheduled to start on Jan. 22, signaling he was prepared for the shutdown to drag on.

“I have never been more depressed about moving forward than right now. I just don’t see a pathway forward,” said Republican Senator Lindsey Graham, a Trump ally, who said it was time for Trump to declare a national emergency.

‘HIS ONLY WAY OUT’

Trump said his lawyers had told him he had the power to invoke national emergency powers to get his wall funded.

“I have the absolute right to declare a national emergency,” Trump told reporters at the White House. “I’m not prepared to do that yet, but if I have to, I will.”

The declaration would circumvent Congress’ power over the national purse strings. A subsequent court fight could be protracted.

The Washington Post, citing two unnamed sources, reported that the White House was laying the groundwork for declaring an emergency that would let Trump build sections of a wall, possibly using funds from the Army Corps of Engineers.

Slideshow ( 16 images )

NBC News, in a similar report, said Trump had been briefed on the plan involving the Army Corps while flying to the border on Thursday. A White House official denied Trump had been briefed on the plan, and the Pentagon declined to comment on the news reports.

Senator Joe Manchin, a moderate Democrat who has cultivated good relations with Trump, told reporters a national emergency declaration by Trump would be “wrong, but I think that’s his only way out” of the impasse.

If Trump were to make such a declaration, Manchin predicted the Senate would immediately pass legislation to fund the federal agencies that have been partially closed.

Slideshow ( 16 images )

FRIDAY PAYCHECKS

Pressure on both sides could intensify on Friday when about 800,000 federal employees miss their first paychecks. About half of them are deemed “essential” to national security, like prison guards and airport security screeners - and have to continue working. Others are home on furlough.

At the FBI, where most agents continue to work, concerns are building that operational funds the bureau needs to conduct investigations, including sensitive undercover operations, are beginning to dry up, said Tom O’Connor, president of the FBI Agents Association.

The shutdown, which began on Dec. 22, will be the longest in U.S. history if it is still going on by Saturday.

In Texas, Trump focused on stories told by tearful family members of people killed by illegal immigrants, and was shown plastic-wrapped bricks of heroin, bales of marijuana, guns and a bag full of cash seized by border agents.

Trump says undocumented immigrants and illegal drugs are streaming across the border, 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.

Raul Ortiz, a local border patrol official, told Trump and reporters that 133 people from countries other than Mexico and those in central America - including India, Pakistan, China and Romania - had been apprehended in the stretch of territory around McAllen.

Just across the Rio Grande, in the Mexican city of Reynosa, a dozen recent deportees and U.S.-bound migrants gathered near a cross that memorialized dead migrants.

Plagued by kidnappings, Reynosa is so dangerous for migrants that locals advise new arrivals against any trip alone out of the two shelters.

“Building a wall for a country, a nation so big, for a border so immense, so many kilometers is ridiculous,” said Jose Ramon Poso Briseno, a Honduran man who has waited in a Reynosa shelter for five months but has so far balked at crossing the river out of fear of cartel violence.