President Trump on Thursday threatened to stop immigration and trade flows across the southern border if migrants flood into the U.S. and create an uncontrollable situation.

"If we find that it's uncontrollable ... if we find that it gets to a level where we are going to lose control or 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," Trump told reporters at his Mar-a-Lago resort in Florida on Thanksgiving.

He said a border closure would also hurt Mexico, since he would seal off all trade until the situation normalizes.

"The whole border, I mean the whole border," he said. "And Mexico will not be able to sell their cars into the United States, where they make so many cars at great benefit to them, not a great benefit to us, by the way."

"We're going to either have a border, or we're not," he warned.

Trump has sent thousands of U.S. troops to the border in anticipation of several caravans that are threatening to cross into the U.S. from Mexico.

Trump has said the U.S. would try to keep people from crossing, but a California judge has blocked that policy for now, after ruling that it goes against the U.S. policy of letting people enter to seek asylum.