Donald Trump has threatened to close the whole US-Mexico border, including halting trade with Mexico, if the arrival of migrants from central America there leads to disorder.
He also said he had given troops at the border the go-ahead to use lethal force if needed.
On Monday the US briefly closed a busy crossing to install new barriers.
Thousands of migrants are at the border after travelling more than 4,000km (2,500 miles) from Central America.
They say they are fleeing persecution, poverty and violence in their home countries of Honduras, Guatemala, and El Salvador.
Mr Trump has deployed about 5,800 troops to the border and has previously described the migrants as an "invasion".
What did Trump say?
"If we find that it gets to a level where we are going to lose control or where people are going to start getting hurt, we will close entry into the country for a period of time until we can get it under control," he told reporters.
"The whole border. I mean the whole border. Mexico will not be able to sell their cars into the United States where they make so many cars," he added.
Mr Trump's reference to lethal force came after Defence Secretary James Mattis said military police at the border would be unarmed.
"They don't have guns in their hands, there is no armed element going in," he told reporters on Wednesday.
On Thursday Mr Trump also warned that the US government could shut down next month if no more money was provided for a wall between the US and Mexico.
"Could there be a shutdown? There certainly could and it will be about border security, of which the wall is a part," he said.
What has Trump said about the judiciary?
He has renewed his attacks after earlier saying a federal judge who blocked his executive order to deny illegal migrants the right to seek asylum was an "Obama judge".
"Judges must not legislate security and safety at the border. They know nothing about it and are making our country unsafe," he said in a tweet.
It comes after Supreme Court Chief Justice John Roberts took the unusual step of rebuking Mr Trump's criticism, telling the Associated Press that "We do not have Obama judges or Trump judges, Bush judges or Clinton judges".
Justice Roberts can say what he wants, but the 9th Circuit is a complete & total disaster. It is out of control, has a horrible reputation, is overturned more than any Circuit in the Country, 79%, & is used to get an almost guaranteed result. Judges must not Legislate Security...— Donald J. Trump (@realDonaldTrump) November 22, 2018
....and Safety at the Border, or anywhere else. They know nothing about it and are making our Country unsafe. Our great Law Enforcement professionals MUST BE ALLOWED TO DO THEIR JOB! If not there will be only bedlam, chaos, injury and death. We want the Constitution as written!— Donald J. Trump (@realDonaldTrump) November 22, 2018
Where are the migrants now?
Almost 3,000 Central American migrants have arrived in the Mexican border city of Tijuana after crossing Mexico and parts of Central America. More than 2,750 have sought refuge in a shelter set up by the mayor's office.
Hundreds of Tijuana residents have protested against the migrants' presence and urged them to leave.
The town's mayor has said he expects the number of migrants in the city to reach 10,000 in the coming weeks.
US officials have warned that anyone found entering the country illegally will face arrest, prosecution and deportation.
What do the migrants want?
The migrants say they are leaving their respective countries in the hope of building a better future for themselves and their families.
Some say they have been threatened or mistreated by criminal gangs operating in their home towns. Many are travelling with their children whom they say they do not want to fall prey to the gangs.
Others hope to get jobs abroad which will pay enough for them to send money to their relatives who stayed behind.
Many say their dream is to reach the US. Some of them have relatives there already whom they hope to join; others have chosen it as their destination because they think they will earn higher salaries there than in Latin America.
While Central Americans have long fled their homelands for the US and have sometimes joined forces along the way, the organised nature of this caravan is relatively new.
Migrants are often kidnapped by people traffickers and drug gangs which force them to work for them. A large group such as this one is harder to target and therefore offers more protection.