President-elect Donald Trump campaigned on the promise not just to crack down on illegal immigration, but to humiliate the country’s southern neighbor by forcing Mexico to pay for his proposed border wall.

There are two sides, however, to Mexico’s key role in the United States’ immigration problem. The incoming administration, like those before it, will have to depend heavily on Mexico to help carry out whatever deportation program Trump settles on.

Jonathan Alcorn/Reuters Donald Trump repeatedly denigrated Mexico on the campaign trail.

The very act of deporting a foreign national usually requires the consent of the receiving country, which has to issue travel documents for incoming deportees. More than two dozen foreign governments routinely refuse to accept deportees from the United States. In some cases, like Cuba, refusal is a matter of policy. In others, like with some African nations, their national bureaucracies can’t efficiently verify the identity of their undocumented citizens abroad and issue travel documents.

That’s not true of Mexico, the country that receives by far the most deportees from the United States. The U.S. has several agreements in place, including memorandums of understanding with the Mexican consulates in nine U.S. border jurisdictions, to expedite the removal of undocumented immigrants, with or without travel papers.

But Trump’s loudly expressed hostility toward Mexico has led prominent political figures there to contemplate some kind of retaliation.

Last month, Jorge Castañeda, a former Mexican secretary of foreign affairs, floated the idea of refusing to accept the return of Mexican nationals who can’t first prove their citizenship. Since many Mexicans who cross the border illegally do so without taking a passport or other identification ― and since about three-quarters of undocumented immigrants removed from the U.S. last year were Mexican nationals ― such a requirement could jam up the entire U.S. immigrant detention system. And that system is already operating over capacity.

“Since many unauthorized Mexican immigrants have no documents, this would shift the political and economic cost of deportation from Mexico to its northern neighbor,” Castañeda wrote in The New York Times. “There would be backlogs, litigation and crowded detention centers. The news media would broadcast scenes of children separated from their parents who are stuck in limbo.”

Despite this potential “humanitarian catastrophe,” Castañeda argued such a move would be justified because “the outcry could conceivably force [Trump] to abandon detestable attempts at mass deportation.”

Mike Blake/Reuters Artists David Gleeson and Mary Mihelic created a version of Trump's wall next to the actual border in Jacumba Hot Springs, California, during the presidential campaign.

Several Latin America analysts told HuffPost that Mexico is unlikely to take such a drastic step. The Mexican government has cooperated with the Obama administration despite a record-setting pace on deportations, and it accommodated expedited returns that routinely topped 1 million annually in the late 1990s.

“There are highly established procedures for repatriations to Mexico — with significant cooperation and involvement with Mexican consulates in the U.S. along the border,” said Faye Hipsman, an analyst with the Migration Policy Institute. “When it comes to its own nationals, there may be things Mexico could do to delay or gum up the repatriation process, but it still is unlikely.”

All agreed, however, that Trump’s aggressive campaign rhetoric vilifying Mexico will collide with the reality that he needs Mexico’s help once he enters the White House. And there are ways Mexico could make U.S. deportations more difficult.

Eric Olson, who heads the Wilson Center’s Mexico Institute, said the Mexican government is “not exactly in the driver’s seat,” but has traditionally worked with the U.S. to keep the deportation process orderly. If they wanted to slow deportations, Mexican officials could limit flight approvals, insist that deportations take place within certain hours, or refuse to accept more than a certain number of deportees per day.

“Mexico could put up certain restrictions, barriers, slow-walk it,” Olson said. “They can certainly push back.”

Perhaps more significantly, Mexico could ease off its own immigration crackdown, which the U.S. has helped fund.

Mexico isn’t just the number one country of origin for undocumented immigrants in the United States ― it’s also an important transit area for people from other countries attempting to reach the United States. When tens of thousands of Central American children showed up at the Texas border requesting humanitarian relief from the U.S. in the summer of 2014, Mexico responded by fortifying its border with Guatemala. Last year, the Mexican government intercepted 173,000 migrants from Honduras, El Salvador and Guatemala ― a 70 percent increase over the prior year and a direct result of prodding by the Obama administration.

Human rights defenders have criticized both Mexican and U.S. efforts to turn away Central American migrants, many of whom are seeking asylum or other forms of humanitarian relief from violence. If Mexico decided instead to allow more of them to pass freely northward ― another step advocated in Castañeda’s New York Times piece ― the number of Central Americans who attempted to enter the U.S. would rise sharply.

“If you look at who’s leaving Central America, especially potential refugees, I don’t think we should be using that kind of population as a bargaining chip,” said Maureen Meyer, a researcher at the Washington Office on Latin America who focuses on Mexico. “That said, if the Mexican government wanted to push back on the United States, you could see them say, ‘Immigration is not a criminal problem in Mexico; we can revert to a more lax enforcement.’”

Susana Gonzalez/Bloomberg via Getty Images Mexican President Enrique Peña Nieto and Donald Trump spoke during a joint appearance in Mexico City on Aug. 31, 2016.

Mexico partners with the U.S. in other ways, large and small, that receive less press but matter to the White House, according to security analyst Alejandro Hope. The U.S. depends on Mexican intelligence to fight drug cartels and human-traffickers operating along the southern border. And when U.S. Border Patrol agents face hazards like people throwing rocks, they often call their Mexican counterparts for help, Hope said.

“I think cooperation will continue on any of those fronts because it’s in both countries’ national interests, but it could become less institutional,” he said. “The big weapon Mexico has is non-cooperation.”

Mexico’s currently unpopular president, Enrique Peña Nieto, has generally avoided confrontation with Trump, even inviting him to Mexico City for a meeting in August. But Mexico elects a new president in 2018, and Peña Nieto’s successor might not be so diplomatic. In that election, Trump may well figure as a symbol of U.S. arrogance, bolstering nationalist sentiment and undermining enthusiasm for cooperation with the United States.

“Trump is so unpopular in Mexico,” Hope said. “It’s going to become costly for Mexican politicians to do any pro-U.S. policies or try to cooperate with the U.S. on specific issues.”