MIAMI -- Not only is the Mexican government not building a wall. It is spending $50 million to beef up its legal aid to migrants who fear deportation, a response to President Trump’s crackdown on illegal immigration.

All 50 Mexican consulates in the U.S. on Friday launched legal assistance centers to form partnerships with nonprofit groups and tap lawyers to provide legal assistance to those fearing Mr. Trump’s policies.

The diplomatic effort comes as the two countries are in a rift over Mr. Trump’s plans for a border wall. While he says Mexico will pay for it one way or another, Mexico says it won’t. It was also unveiled less than two weeks after new guidelines came out aimed at aggressively detaining and deporting immigrants by increasing the number of federal agents and strengthening cooperation with local law enforcement.

Get Breaking News Delivered to Your Inbox

Miami’s Mexican consul general, Jose Antonio Zabalgoitia, said Friday that these centers would become “authentic advocates of the rights of Mexican migrants.”

“What changes today is that we are prioritizing legal matters over everything. Previously, we didn’t have the need to seek so much legal support for our people,” he said. “But now, we need to protect them against an eventual deportation.”

Mexican consulates are forming partnerships with law schools, immigration clinics and nonprofit groups that litigate on behalf of immigrants. The centers are staffed with Mexican lawyers who can refer cases to organizations or clinics. They are also reaching out to private attorney firms interested in taking on pro-bono work.

Later this month, the Miami consulate will hold an event titled “immigration diagnosis,” in which it will review individual cases with other groups to study the possibility of legalizing a person’s status.

Consulates from Mexico and other Central American nations have been juggling numerous inquiries in recent months from migrants concerned about their fate and that of their U.S.-born children.

Zabalgoitia said the increase in requests for documents and help is “enormous,” as he pointed to a waiting room with dozens of people carrying folders of documents in need of birth certificates, Mexican passports and other identifications. “I used to sign two birth certificates a week. Only yesterday, I signed 15.”

In the Philadelphia consulate, which also covers Delaware and southern New Jersey, daily appointments at the consulate have doubled to 400 people. “They are concerned about their situation,” said Alicia Kerber-Palma, Mexico’s consul general for the Philadelphia region, where about 200,000 Mexican immigrants live.

Mexican diplomats in Boston have been meeting with families at churches and community events to explain to them the challenges of claiming U.S.-born children, without dual nationality, after deportation.

Divina Ciriaco, a 45-year-old housekeeper who lives in the Miami area, said she is gathering all the documents she would need for her U.S.-born boy to go along with her if she is deported.

“We live in fear of going back to Mexico, to the violence, the poverty we suffered,” said Ciriaco, who migrated along with her husband and two children 20 years ago from the state of Guerrero. She gave birth to her third child in Miami. “Now, it’s just a matter of waiting for that day to come.”