When President Trump announced Friday that the United States and Mexico reached a deal to avert tariffs and that Mexico would step up efforts to reduce illegal immigration from Central America, both governments hailed the deal as a big victory.

Mexico agreed to allow Central Americans to wait in Mexico while their asylum claims are processed. They also said they were sending thousands of National Guard troops to the Mexico-Guatemala border.

The Trump Administration believes such measures will significantly reduce illegal immigration and solve the border crisis.

If only they could.

The unfortunate reality is that the Mexican government can’t solve the crisis on its own any more than the United States can.

As a matter of policy, neither country can completely control the two things that have most contributed to peace and security on the border throughout its 183-year history: the political stability of Mexico and the orderly movement of workers across the border. But by working together in light of this history, both countries could craft policies to shore up these twin pillars of border security and greatly mitigate the current crisis.

Strictly speaking, the U.S.-Mexico border has never really been secure.

From the Texas Revolution, to the border wars of the early twentieth century, to the rise of international drug cartels in the 1980s, all the way up to the current crisis. The southwest frontier has always been a dangerous place marked by lawlessness, volatility, and occasional spasms of violence.

This is because historically Mexico has struggled to exercise control over its northern territory. The border banditry that arose in the mid-nineteenth century was possible only because Mexico’s central government had almost no ability to stop it. The violence and retribution that accompanied the Mexican Revolution in the second decade of the twentieth century was likewise triggered by Mexican rebels. Even the current migrant crisis is being driven by elements beyond the government’s control: profit-driven criminal smuggling networks in collusion with corrupt Mexican police and drug cartels.

The United States used to take a rather hard line on this issue. When Pancho Villa raided the town of Columbus, New Mexico, in March 1916, killing 18 Americans, President Woodrow Wilson ordered the Pancho Villa Expedition. This was a massive U.S. military intervention that would see large numbers of American forces stationed south of the Rio Grande for nearly a year. And that wouldn’t be the only incursion into Mexican territory carried out by U.S. armed forces during this period.

The logic of American policymakers was simply that if Mexico City was unable to stop cross-border raids and impose order in northern Mexico, then the United States would do so unilaterally.

In recent decades, the problem hasn’t been bandits. Rather international drug cartels that control vast swaths of territory in northern Mexico. In some places these cartels operate with impunity, if not the cooperation of government officials.

The current migrant crisis has in some ways been grafted onto the narcotics trade as migrant-smuggling has become an entire industry of its own. By some estimates, cartels and smuggling networks made as much as $2.3 billion from Central American migrants in 2017. They are likely making much more than that now as the number of families and minors crossing the border continues to rise.

Consider that migrant families are paying as much as $7,000 per person to get into the U.S. This includes a “tax” that must be paid to whatever cartel controls the area of the border where they intend to cross. In April, U.S. Border Patrol apprehended more than 67,000 family units and minors. If they paid an average fare of $4,000, that’s $268 million—just in a single month.

Asking Mexico to put an end to all this on its own is like asking it to put an end to drug trafficking. The Mexican government, already reeling from record levels of crime, simply can’t do it. Nor for that matter, can the weak governments of Honduras, El Salvador, and Guatemala.

What the U.S. can do is lend them a hand. The Department of Homeland Security recently sent dozens of agents and investigators to Guatemala to help authorities there disrupt and interdict human smuggling operations. That’s a good first step, and could be expanded to Honduras, El Salvador, and Mexico.

The other factor that has contributed to peace and security on the border is the regulated flow of labor across the border. This is also ripe for reform and binational cooperation.

The reality is that most illegal immigration is a function of labor responding to U.S. demand. Many of the Central Americans now claiming asylum are economic migrants who freely admit they are fleeing poverty at home. At a time of low U.S. unemployment, there is plenty of work for these people in America, and they know it.

There was a time when the U.S. government recognized this and crafted policy accordingly.

When Congress created the U.S. Border Patrol in 1924, its purpose was to stop liquor-smuggling from Canada and illegal immigration from Mexico. Illegal immigration was something of a new phenomenon at the time. The borderlands of south Texas had for centuries been used as cattle ranges or not at all. But the advent of new technologies like railroads and irrigation made large-scale agriculture possible in the Rio Grande Valley. This brought large numbers of Mexican laborers north.

Hundreds of thousands of Mexicans would migrate into Texas during the 1920s and ‘30s. By 1950, there would be more than a million Mexicans living in the state.

To meet these new conditions, the federal government created the Bracero Program in 1942. This brought in foreign guest workers and prevent agricultural labor shortages during World War II. Intended as a temporary wartime measure, the program was extended and expanded after the war, in part as a way to manage cross-border labor flows. The program had serious flaws, including the mistreatment of Mexican workers. Nonetheless it represented a concerted binational effort to exert control over the border. Workers caught crossing the border illegally, or caught working without a bracero contract, were deported to Mexico and either given a contract or handed over to Mexican authorities.

Among the program’s fiercest opponents were fledgling farm labor unions like the United Farm Workers, which didn’t want to compete with foreign labor. This eventually succeeded in killing the program in 1964.

The end of the Bracero Program was effectively the beginning of mass illegal immigration. Former braceros continued to work in a booming U.S. agriculture industry. But now as illegal immigrants in a labor black market, not as legal contract laborers.

The very next year Congress passed the Immigration and Nationality Act. This established the basis for our current immigration regime, emphasizing family reunification over employment as the primary basis for immigration. The law did not adequately account for labor demands in the U.S. As a result, illegal immigration skyrocketed.

In the 1960s, apprehensions of illegal immigrants totaled just 1.6 million. In the 1970s, they totaled 8.3 million. The following decade they reached 11.8 million. This trend would continue until 2000, when apprehensions peaked and then began dropping precipitously.

The most obvious explanation for this drop is that Mexicans stopped coming to the U.S. because there were fewer jobs available. The dot-com crash of 2000 and the 2008 financial crisis both roughly track with a sharp decline in illegal immigration and the growth of the Mexican economy.

We are now seeing illegal immigration rise once again. Not from Mexico, but rather from Central America. Here, a toxic combination of instability, violence, and poverty, along with the promise of employment in the U.S., is pushing record numbers of people north.

Ending the crisis will require reorienting our approach to border security.

We need to craft policies that go beyond securing the physical border and promote stability south of the Rio Grande. That means helping Mexico and Central America crack down on criminal smuggling networks that are profiting off asylum-seekers, as well as reforming our outdated asylum system.

It also means creating a twenty-first century Bracero Program that eliminates the black market for labor; properly manages labor shortages in an orderly, controlled way; and reduces the incentive to game our asylum system or enter illegally.

The crisis at the border is in some ways new, but the forces driving it are not. History suggests it will take more than manpower and border fencing—and certainly more than Mexico can muster on its own—to achieve what most Americans want: a peaceful and secure border.