When the mayors of Mexico City, Ciudad Juarez, and Guadalajara recently traveled to the United States to discuss the fallout from the Trump administration’s immigration policies, they did not go to Washington to speak with White House officials or members of Congress. Instead, they headed to Chicago to meet with Mayor Rahm Emanuel to discuss what the four cities could do to assist families, individuals, and businesses confronting the swift policy shift.

Chicago is just one of many U.S. cities, including New York, Los Angeles, and smaller regional hubs like Austin, Houston, Boston, Miami, and San Francisco, that cultivate and maintain global relationships. Such cities all have their distinctive, economic, political, and social niches in the United States. But they also have their own distinctive leverage in international affairs, courtesy of links that imbue city leaders with unprecedented influence at a time when President Trump’s views on immigration and the “horrible” inner cities are alarming allies around the world.

City officials who serve the needs and demands of diverse communities have emerged as global catalysts for innovative thinking on issues from immigration to climate change. As national leaders who have a range of tools, from diplomacy to warfare, for managing issues and settling disputes, the heads of cities rely on different toolkits to deal with things like economic development and immigration, and persistent stresses like crime and poverty.

“Mayors understand the world’s shifting demographics and its trending economics, both of which are in their favor,” argued Peter Engelke, a senior fellow at the international think tank the Atlantic Council, in his 2015 analysis, “Foreign Policy for an Urban World: Global Government and the Rise of Cities.” “Aware of this clout, the world’s mayors have forced their way into the global conversation, and cities’ growing power ensures that the interstate system will have to accommodate them over time.”

Nation-states have had varying degrees of difficulty adapting to internet-accelerated globalization. That gulf has created a space for cities to emerge as exemplars of a new role for government in a rapidly changing world. These developments have led municipal leaders to pursue ties with like-minded men and women across borders to carve out solutions that suit their urban communities. Where heads of state remain encumbered by historic enmities and geopolitical calculations, mayors and other local officials must be more nimble, literally meeting people where they live and responding to basic human needs like water, food, shelter, jobs, and transportation. Alongside these necessities, successful urban leaders must nurture aspects of the human experience, such as education, arts, culture, and sports, that make communities vibrant and worth living in and visiting. The upshot is that when immediate concerns over immigration and longer-term perils like climate change arise, mayors are society’s first responders.

Cities can craft their foreign policies to suit their aims, but they have certain things in common: The prosperity of cities depends on the free flow of money, goods, and people. Although Trump has tapped into a vein of outrage about undocumented immigrants, his carelessly implemented policies have stirred up economic fears on both sides of the southern border. Talks between the United States and Mexico over the president’s proposal to build a wall to keep out undocumented people and stop drug trafficking have proved futile. Mexican President Enrique Peña Nieto canceled a January meeting with Trump after the president again insisted that Mexico would pay for the wall’s construction.

In their meeting this month with Emanuel, Mexican municipal leaders struck a different tone. Mexicans comprise nearly 80 percent of Chicago’s Latino population, and Mayor Emanuel; Miguel Angel Mancera of Mexico City; Enrique Alfaro of Guadalajara; and Hector Armando Cabada Alvídez of Ciudad Juarez emphasized their cities’ longstanding ties. Four years ago, Mancera and Emanuel signed an economic and cultural agreement to facilitate contacts between their cities. Nevertheless, the immigration crisis dominated the meeting. Emanuel pledged in the meeting that Chicago would remain a sanctuary city. Alfaro, his Guadalajara counterpart, weighed in that the current problems for both countries stem from the inability of the United States to craft coherent immigration reforms. “Sometimes federal governments are doing very little to give us certainty about things,” Alfaro told the Chicago Sun-Times.

Indeed, some American border cities are sidestepping these uncertainties with renewed commitments to cross-border relationships. In a recent joint news conference, San Diego Mayor Kevin Faulconer and Tijuana Mayor Juan Manuel Gastélum highlighted their cities’ economic and cultural bonds. Faulconer, the rare Republican leader of a major metropolis, went further and declared that the two cities comprise a “mega region” based on their proximity, similar histories, and collaborative instincts. Indeed, metropolitan regions composed of cities, suburbs, and adjacent rural areas are even better positioned to craft intricate economic development strategies and respond to people fleeing conflicts and seeking jobs.

A southern border wall is one of Trump’s most cherished priorities, but the major cities on both sides of any new barrier are determined to sustain the ties that have fueled their own growth and development. Can cities continue to nurture their collaborative instincts and remain engaged in the world that they have built? Municipal leaders’ powers have limits. They have their own political constraints, and cannot forestall the international discord that national governments unleash. But they can control their cities’ responses and steer their own economic destinies. Trump’s presidency creates a perilous moment that will demand a special kind of leadership as American mayors consider how to protect their cities’ reputations for innovation and openness.