WHILE PRESIDENT-ELECT Donald Trump continues touting the value of a beautiful wall on the U.S.-Mexican border, a more lucid analysis was offered this week by his nominee to lead the Department of Homeland Security, retired Gen. John F. Kelly.

Mr. Kelly gained expertise on cross-border issues as head of U.S. Southern Command for more than three years, until his retirement from the Marine Corps a year ago. He explains that a wall will not, on its own, do much to protect Americans.

In confirmation testimony Tuesday, he was explicit on that point, as well as on the importance, for America’s security, that he would accord to good relations with Mexico.

In his news conference Wednesday, Mr. Trump lauded America’s southern neighbors in one breath — “so nice,” “respect,” “terrific” — while in the next breath asserting categorically that Mexico has “taken advantage of the United States.” Presumably he meant, as he said in the past, that Mexico has “sent” its least desirable inhabitants northward.

In fact, the net flow of Mexicans in recent years has been southward, out of the United States and back to their native land. To the extent that they and other migrants from Latin America continue to travel north, it is not as a result of some clever or malicious plot, but by the laws of supply and demand in the labor market. Mexico and countries farther south are a source of cheap workers, for which the U.S. economy has for many years had a voracious appetite — to work in farms, kitchens, gardens and some of Mr. Trump’s company’s own construction sites. That’s the “pull” factor that has drawn migrants from the south. The push factors, in addition to poverty, include an epidemic of drug-related violence, especially in Guatemala, El Salvador and Honduras.

Mr. Kelly gets that, and even expressed a measure of empathy. For the most part, he told the Senate Committee on Homeland Security and Governmental Affairs, which is weighing his nomination, migrants “don’t want to come up and leave their homes, their families. But there is not an awful lot of economic opportunity for them there.”

As for the wall, the Homeland Security nominee offered a clear-eyed view. “A physical barrier in and of itself will not do the job — it has to be a layered defense” that includes sensors, Border Patrol officers and, Mr. Kelly emphasized, cross-border cooperation, “including partnering with some great countries.” We hope his understanding, if Mr. Kelly is confirmed, will inform Trump administration policy.