FRONTERA HIDALGO, Mexico (Reuters) - Mexican authorities on Thursday adopted tougher measures against Central American migrants, detaining 800 of them who had entered Mexico illegally from Guatemala intending to reach the border with the United States.

Mexico is under intense pressure from U.S. President Donald Trump to contain mass movements of migrants, most of them from Central America, who have been crossing through Mexico on their way to the U.S. border.

The National Migration Institute (INM) said it had transferred 800 migrants, some of them unaccompanied minors, to immigration centers where they would be given food, medical attention and shelter.

If their legal status cannot be resolved, they will be returned to their home countries. The INM also said it was looking for another 200 migrants who had remained in the area.

Earlier in the day, security forces with riot shields corralled migrants, including families with small children, after they had entered Mexico across the Suchiate River from Guatemala.

Slideshow ( 25 images )

Some migrants in the caravan had been given forms to seek asylum with Mexico’s asylum agency, COMAR. Many of the migrants heading north say they are fleeing economic hardship and violence at home.

The current group is the largest surge of people to test Mexico since its president, Andres Manuel Lopez Obrador, reached agreements with Trump and some central American governments to reduce pressure on the U.S. border.

Trump has threatened to punish Mexico and Central American countries economically if they fail to rein in migrant flows.

Migrants crossing into Mexico this week faced tear gas from security forces, in a firmer response than seen in previous mass crossings.

Mexican Foreign Minister Marcelo Ebrard said several hundred of the new arrivals were immediately deported.