Pedro took them to Honduras, where other smugglers took over in Honduras and then Guatemala. The hardest and most expensive part of the journey was Mexico, where violence, crooked police and the threat of deportation always loomed.

All six of the Mauritanians eventually crossed the border by Lukeville, Ariz., then flew to New York after being briefly detained in Tucson. They spent between $10,000 and $15,000 for the entire trip — flights, smuggling fees and bribes included — with proceeds from the quick sale of cars, land and, in one case, four camels that one of the migrants stole from his estranged father.

Not every migrant who ends up in the city’s care intended to do so. Nilson, 39, left Maracaibo, Venezuela, planning to stay with a cousin in Paterson, N.J. But when he got there, he discovered he was no longer welcome. The cousin gave him $30 and texted him a flier, in Spanish, with the directions to the “Centro de llegada” — the arrival center — at the Roosevelt Hotel.

“Without this help,” he said in a recent interview in Spanish, “I would have been sleeping in the streets.”

Nilson is now in Albany, one of hundreds of migrants sent by the city to upstate motels, where the city pays for their room, board and other ancillary expenses. Only two of the migrants interviewed by The Times — Ousmane, 34, and Amidou, 42, both from Mauritania — are still at the East 30th Street shelter. It’s the site of the old Bellevue Psychiatric Hospital, a decades-long symbol of despair and terror that became a homeless shelter in the mid-1980s.