Mexico is trying to curb a surge of migrants from third countries crossing its territory in order to reach the United States, under the threat of tariffs on its exports by U.S. President Donald Trump, who has made tightening border security a priority.