Trump's tariff threat comes at a time when Mexican authorities have been carrying out migrant raids and detaining thousands more who are traveling through the country on the way to the U.S.

The crumbling city of Tapachula, near the Guatemalan border, has become the epicenter of the crackdowns. Thousands of migrants have been stranded in the city because the Mexican government isn't providing them visas that allow them to travel. Authorities this week have been clearing out parks of camping migrants and raiding hotels where immigrants were staying.

Mexican authorities raided and largely broke up the last major migrant caravan, detaining hundreds of immigrants from Central America.

And the Mexican government has allowed the U.S. to return hundreds of asylum seekers from Central America and other countries to force them to wait their cases out in Mexico — in one of only a few immigration policies that have not been immediately struck down by the courts.

The White House said Trump would be using the International Emergency Economic Powers Act to implement the tariff.

"If the illegal migration crisis is alleviated through effective actions taken by Mexico, to be determined in our sole discretion and judgment, the Tariffs will be removed," the White House said in a statement.