WASHINGTON — President Donald Trump said Thursday that U.S. troops he dispatched to the nation's border will use lethal force to stop migrants attempting to enter the country "if they have to."

Earlier this week, Trump authorized the military to use its rules of engagement, rather than those of domestic law enforcement agencies, at the border.

"If they have to, they're gonna use lethal force," he said. "I've — I've given the OK. If they have to. I hope they don't have to."

He added that he will "close entry" at the border if he deems it necessary to prevent immigration. Just before the midterm elections this month, Trump sent thousands of troops to the U.S.-Mexico border in response to the advance of caravans of migrants through Latin America.

Secretary of State Mike Pompeo reinforced the president's message in a statement Thursday, saying: "The caravans will not be permitted to enter the United States. There are real dangers to the safety and human rights of migrants from those who would prey on them."

Critics of Trump's use-of-force policy have said it runs the risk of entering a thicket of federal statutes, constitutional principles and international law — most notably the Posse Comitatus Act, which, with some exceptions, precludes the military from domestic law enforcement activities.

"The Posse Comitatus Act keeps the President from using troops to enforce domestic policy. For all the obvious reasons," Joyce White Vance, a former federal prosecutor and MSNBC contributor, wrote Wednesday on Twitter. "It was enacted in 1878. Only Trump would think to violate it & as all things with Trump, once you violate a norm, it's a fast slide down the slippery slope."

Trump, who has been frustrated by congressional refusal to provide funding for the border wall he promised to build between the United States and Mexico, has repeatedly portrayed migrants fleeing Central America as an invading force.

Most Democrats and some Republicans oppose the border wall, and House Democrats' victory in the midterms means he is less likely to get the money he is seeking.

Trump said he will entirely close the border — to people and trade — if Mexico doesn't stop migrants from trying to come into the United States.

"That means the Mexico's not going to be able to sell their cars into the United States until it's open," he said Thursday. "But we're going to need to have a border or we're not. And when they lose control of the border on the Mexico side, we just close the border."