The Brazilian state of Acre has declared a state of emergency after a surge of illegal immigrants from neighbouring Bolivia and Peru.
Officials said most of the immigrants originally came from Haiti but others had come from as far afield as Bangladesh, Senegal and Nigeria.
They said about 1,700 illegal migrants had arrived during the past two weeks.
Acre, in the Amazon region, has asked for additional funding from the federal government to cope with the influx.
More than 5,000 Haitians have arrived in Acre since 2010, but in recent months there has been an increase in immigration from Senegal, Nigeria, the Dominican Republic and Bangladesh.
Officials say the routes through Peru and Bolivia have become popular with people smugglers because dense vegetation makes it difficult for border police to patrol them.
Most of those who get caught are housed in a temporary shelter in the town of Brasileia, 280km (173 miles) south-west of the state capital Rio Branco.
It is estimated that 10% of Brasileia’s 20,000-strong population are immigrants who arrived within the last two years.
Many of them are Haitians who fled their country after the 2010 earthquake, which left much of Haiti devastated.
Resident Eli Lima de Freita told BBC Brasil that the town was in a state of “absolute chaos” as the authorities struggle to house and feed the immigrants.
State authorities say dealing with the unexpected wave of illegal immigration has cost them about $1.5m (£1m) over the past two years.
Haitian immigrants described flying from the Haitian capital, Port-au-Prince, to Panama, then to Ecuador, from where they journeyed on by land to either Peru or Bolivia.
From there they crossed into Acre, often paying “coyotes” or people smugglers to get them across the border.
The Senegalese said they had travelled north from Senegal to Morocco, crossing over to Spain, from where they flew to Ecuador.
From there, they continued along the same route taken by the Haitians.
For many, Acre is not the final destination. They said they were trying to reach big urban centres in Brazil, such as Sao Paulo and Rio de Janeiro, but would stay wherever they could make a living.
Brazilian police last year raided a number of sweatshops in the capital, Brasilia, and in Sao Paulo, where undocumented immigrants from Bolivia and Pakistan were found working in unsafe conditions for very little or no pay.