Thousands of Haitians face being deported from the Dominican Republic as a new immigration law comes into force on Thursday 18 June.
For the last few weeks long queues have formed outside the Ministry of the Interior in Santo Domingo. People clutched documents they hoped would be sufficient to establish their legal status and allow them to stay in a country that, for some at least, is the only home they have ever known.
The queues showed no signs of abating as the midnight deadline approached; many people had been waiting since the night before.
Nearly all were from Haiti or of Haitian descent.
Non-citizens must show they have been in the country since before October 2011 to qualify for legal residency. Dominican officials say anyone lacking proper identity documents or who has not registered for a so-called "regularisation" programme before the deadline could face deportation.
The Interior Ministry has said there are about 500,000 people who could qualify for residency under the programme. So far, about 250,000 have registered, but officials said only about 10,000 have produced sufficient documentation.
Minister of the Interior and Police, Monchy Fadul, said those who remain in the queue and within the specified area after the deadline will be attended to.
The Dominican government says the changes to its nationality laws aim to tackle illegal migration from neighbouring Haiti. Human rights groups say the move is rooted in racism and xenophobia in the Dominican Republic towards darker-skinned Haitians.
Human rights groups say they fear that migration agency officials and the military will deport people arbitrarily if they look Haitian or speak Spanish with a Creole accent as has been done in the past.
Over the last century hundreds of thousands of Haitians have crossed into the more prosperous Dominican Republic to escape political violence or seek a better life. Many end up working as poorly paid sugar cane cutters.
Human rights groups say the 2014 law could impact as many as 200,000 Dominican-born people of Haitian descent who lost their Dominican citizenship after a constitutional court ruling in 2013 that has come under international criticism. The ruling reversed the right of citizenship for foreigners born in the Dominican Republic, stripping children of Haitian migrants of their Dominican nationality.
The Dominican army says 2,000 troops are ready to help coordinate the removal of people who fail to meet legal requirements to remain in the country.
Local media have reported the government has dozens of buses ready to transport undocumented people to the Haitian border. The Haitian government has cleared a field near the border-crossing point at Malpasse to provide assistance to people who have been deported.