(New York Times)WASHINGTON — The White House said Tuesday night that President Trump planned to deploy the National Guard to the southern border to confront what it called a growing threat of illegal immigrants, drugs and crime from Central America after the president for the third consecutive day warned about the looming dangers of unchecked immigration.

Mr. Trump’s advisers said Monday that he was readying new legislation to block migrants and asylum seekers, including young unaccompanied children, from entering the United States, opening a new front in the immigration crackdown that he has pressed since taking office. But in remarks on Tuesday that caught some of his top advisers by surprise, he suggested the more drastic approach of sending in the military to do what immigration authorities could not.

Speaking to reporters during a news conference with the presidents of three Baltic nations, Mr. Trump described existing immigration laws as lax and ineffective, and called for militarizing the border with Mexico to prevent an influx of Central American migrants he said were ready to stream across it.

“We have horrible, horrible and very unsafe laws in the United States,” Mr. Trump said. “We are preparing for the military to secure our border between Mexico and the United States.”

While the president couched his idea as an urgent response to an onslaught at the nation’s southern border, the numbers do not point to a crisis. Last year, the number of illegal immigrants caught at the border was the lowest since 1971, said the United States Border Patrol. Still, Mr. Trump seized on what has become an annual seasonal uptick in Central American migrants making their way north to make his case.

After the president’s remarks, White House aides struggled for hours to decipher his intentions.

Late in the day, Sarah Huckabee Sanders, the White House press secretary, said Mr. Trump had met with Jim Mattis, the secretary of defense, and members of the national security team to discuss his administration’s strategy for dealing with “the growing influx of illegal immigration, drugs and violent gang members from Central America,” a problem on which she said the president had initially been briefed last week.

That strategy, she said, included mobilizing the National Guard — though Ms. Sanders did not say how many troops would be sent or when — and pressing Congress to close what she called “loopholes” in immigration laws. Also present at the meeting were Jeff Sessions, the attorney general; Kirstjen Nielsen, the secretary of homeland security; Gen. Joseph F. Dunford Jr., the chairman of the Joint Chiefs of Staff; and John F. Kelly, the White House chief of staff.

Mr. Trump first began raising new dangers posed by immigration in a series of confusing tweets and public statements that started Sunday and continued on Monday. That prompted White House officials to organize a conference call on Monday afternoon to outline a detailed legislative push they said the president was starting for the new immigration restrictions. Deploying the National Guard was not mentioned during the call.

The announcements on Monday and Tuesday appeared to be more about political messaging than practical action. Stung by a backlash from his conservative supporters over his embrace of a trillion-dollar-plus spending measure that did not fund his promised border wall, and lacking a legislative initiative to champion with the approach of midterm congressional elections this fall, Mr. Trump has reverted to the aggressive anti-immigration messaging that powered his presidential campaign and has defined his first year in office.

Immigration advocates denounced Mr. Trump’s announcement as a political ploy.

“He cannot get funding for his wall, so instead he irresponsibly misuses our military to save face,” Kevin Appleby, the senior director of international migration policy at the Center for Migration Studies of New York.

Others said Mr. Trump’s sudden declaration was merely an instance of a now-familiar pattern wherein the president reacts angrily to something he sees in the news — in this case, reports of a large group of migrants from Honduras traveling through Mexico with hopes of reaching the United States — and seeks to use it as a cudgel against his political opponents.

“Some of it is just the guy at the end of the bar yelling his opinions — his gut reaction is to say we’ve got to send the military,” said Mark Krikorian, the executive director of the Center for Immigration Studies, which advocates slashing immigration levels. “But there may also be an element here of political messaging — and a desire to create problems in November for Democratic candidates who have refused to embrace his policies.”

Whatever Mr. Trump’s motivation, the president floated the idea after days of public stewing about the potential for the group of Honduran migrants to pour into the United States.

“We have very bad laws for our border, and we are going to be doing some things — I’ve been speaking with General Mattis — we’re going to be doing things militarily,” Mr. Trump said Tuesday morning, seated beside the defense secretary at the meeting with Baltic presidents. “Until we can have a wall and proper security, we’re going to be guarding our border with the military. That’s a big step. We really haven’t done that before, or certainly not very much before.”

The caravan has been a popular topic on Fox News — the president’s favorite news network — and Mr. Trump’s aides have argued that weak immigration policies were luring the migrants to the United States from Central America.

“The big Caravan of People from Honduras, now coming across Mexico and heading to our ‘Weak Laws’ Border, had better be stopped before it gets there,” he posted Tuesday on Twitter. “Cash cow NAFTA is in play, as is foreign aid to Honduras and the countries that allow this to happen. Congress MUST ACT NOW!

Later, Mr. Trump claimed credit for having pressured Mexican officials during a conversation on Monday to block the group from approaching the United States, in part by threatening to rip up the North American Free Trade Agreement if they refused.

“I’ve just heard that the caravan coming up from Honduras is broken up, and Mexico did that,” he said during his meeting with the Baltic leaders. “And they did it because, frankly, I said, ‘You really have to do it.’”

A White House official said later that Mr. Trump had not, in fact, spoken with President Enrique Peña Nieto of Mexico on Monday.

While the active-duty military is generally barred by law from carrying out domestic law enforcement functions, such as apprehending people at the border, previous presidents have deployed National Guard troops to act in support roles on the border with Mexico. President Barack Obama sent 1,200 in 2010 and President George W. Bush dispatched 6,000 in 2006, while governors of border states have done the same when faced with large inflows from the south.

Mr. Trump has spoken before about launching a military operation to police the border, only to have his aides walk back the remarks amid a backlash from members of his administration and officials in Mexico.

Last February, he called his immigration crackdown “a military operation,” prompting Rex W. Tillerson, then the secretary of state, and Mr. Kelly, then the homeland security secretary, who were visiting Mexico at the time, to push back vigorously. They told their Mexican counterparts and reporters that the American president did not, in fact, plan to use the military to hunt down and deport unauthorized immigrants. The White House later insisted that Mr. Trump had meant the word “military” only as an adjective.

On Tuesday, though, the president appeared convinced that American troops were needed.

“I think it’s something we have to do,” he said.