German Chancellor Angela Merkel said that border walls “will not solve the problem” of illegal immigration during a visit to Mexico Saturday.

Merkel, sitting next to Mexican President Enrique Peña Nieto at a meeting with Mexican business leaders at the Interactive Economics Museum in Mexico City, said that countries should “forge sensible relationships with their neighbors” who fail to fix the issues driving their citizens away.

Her remarks, translated by The Hill, read:

“Obviously the main reason for people leaving must be addressed on site first, which means putting up walls and cutting oneself off will not solve the problem,” Merkel said, speaking in Mexico City. “It’s an issue you can study well in the history of China with the (Great) Wall of China, you can study it in the history of the Roman Empire. Essentially, only when great empires have managed to forge sensible relationships with their neighbors and to manage migration has it been a success.” Merkel added that she doesn’t think that “by simply improving the border facilities you can solve the problem.”

Merkel’s remarks are a veiled shot at President Donald Trump, who campaigned on a promise to build a wall on the U.S.-Mexico border. President Peña Nieto, who has been accused of being too soft on — or even in bed with — Mexico’s drug cartels, has attacked the idea of building a barrier protecting Americans from cartel violence. “Mexico does not believe in walls,” he said shortly after Trump’s inauguration.