President Donald Trump said on Tuesday he would use US military forces to protect the nation's southern border with Mexico until there is a border wall and "proper security" in place.

"We are going to be doing things militarily," Trump told reporters at the White House, adding he had discussed the idea with US Defense Secretary Jim Mattis.

"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," he said. "We cannot have people flowing into our country illegally, disappearing, and by the way, never showing up for court."

Earlier on Tuesday, Trump had said US foreign aid to Honduras and other countries was at risk unless they stopped what he called a "caravan" of more than 1,200 Central American migrants headed to the US border with Mexico on a 2,000-mile (3,200-km) journey from the Mexico-Guatemalan border.

Mexico's government has said such "caravans" of mostly Central Americans, including many escaping violence in Honduras, have occurred since 2010.

Trump has stepped up his immigration rhetoric in recent days and his administration has moved to further crack down on people who are in the United States illegally.

Trump has already blasted Mexico and threatened to upend the North American Free Trade Agreement (NAFTA) over the caravan. The current trip has also put pressure on Mexican authorities ahead of the July 1 presidential election there.

"We will be doing things with Mexico, and they have to do it, otherwise I'm not going to do with the NAFTA deal," Trump told reporters.

In a post on Twitter, he had said the caravan "heading to our 'Weak Laws' Border, had better be stopped before it gets there. Cash cow NAFTA is in play, as is foreign aid to Honduras and the countries that allow this to happen. Congress MUST ACT NOW!"On Monday, the Republican president railed against Democrats over immigration and again pressed US lawmakers to pass legislation to build his long-promised border wall between the United States and Mexico.

Despite months of efforts, no immigration deal has emerged in the Republican-led Congress, where lawmakers are not expected to pass much major legislation ahead of November's midterm congressional elections.