foreigners as novel and unfamiliar invaders.

Race, ethnicity and nationality matter. Most of the immigrants who have the resources or corporate sponsorship to gain legal residency here come from the United States and Europe. The thousands of Central American immigrants coming to Mexico without visas — to work on farms or in cities, or to get to the United States — are often greeted with beatings by the Mexican police or intense pressure to work for drug cartels. Koreans also say they often hear the xenophobic refrain, “Go back to your own country.”

Mr. Sánchez, the hair products salesman from Venezuela, said Mexicans who had not been able to rise above their economic class mostly seemed to resent the mobility of immigrants. In a country still scarred by the Spanishidealists, like Luna Mancini, 27, a human rights lawyer working for the Supreme Court who was born in Mexico to Italian parents. After growing up in Barcelona, Spain, she returned to Mexico in 2009 because she felt that more could be done in Latin America, with law and with new tools of communication — digital video, social media — that encouraged grass-roots dialogue. Some, especially Mexican-Americans working in Mexico City’s hip culinary scene, have come here to reconnect with their roots. Others simply see Mexico as their best option, as an incubator for personal, professional and artistic growth.