Peru's president decreed a state of emergency at the South American country's borders Wednesday and ordered the deployment of troops to reinforce checkpoints and block undocumented migrants making their way north from Chile.
Hundreds of migrants, who the United Nations says are mainly from Haiti and Venezuela but had been living in Chile, have been blocked for weeks at the border between the Peruvian city of Tacna and Arica in northern Chile.
Many say they are seeking a way home or plan to continue further north to the United States.
On Wednesday, President Dina Boluarte said extra soldiers will be deployed to support police at border crossings with Chile, Bolivia, Brazil, Ecuador and Colombia.
"The national police will maintain control of internal order with the support of the armed forces," Boluarte told a press conference.
The state of emergency is due to take effect on Thursday, but the government did not say what it would entail, or how long it would remain in place.
Pointing to press reports claiming that "those who commit daily assaults, robberies and other criminal acts are foreigners," Boluarte said her decision was aimed at combating threats to security.
"That is why we have to speak almost in unison of migration and citizen insecurity," she added.
Hundreds of migrants have been crowded for weeks in improvised camps at the border crossing between Peru and Chile, stuck in limbo between the two countries.
The majority are from Haiti and Venezuela, according to the UN's refugee agency.
Many migrants claim they intend to cross through Peru to get to their countries of origin, or to the United States, in order to reunite with their families.
"We are between a rock and a hard place. We are doing this because we have our needs, but waiting here for a week, two weeks... nobody would want to do that," Venezuelan Yosier Canelon told AFP.
Boluarte also announced that those who have entered Peru in recent years "will have a period of six months to go to the Peruvian authorities to regularise their situation."
There are an estimated 1.3 million Venezuelans in Peru, accounting for nearly nine out of 10 foreigners in the country, and one third do not have a permit to stay, according to Peru's National Institute of Statistics and Information.
The UN refugee agency is advocating for a humanitarian solution to their plight.
It said in a statement Wednesday that it was important to have channels for migrants to access Peru if they are seeking international protection, family reunification or have other humanitarian issues.
But the agency welcomed some of the measures announced by Lima, including an amnesty in fines that will allow 100,000 refugees and migrants in Peru to normalise their status.