Fred McMahon is the Michael Walker Chair of Economic Freedom Research with the Fraser Institute.

The presidents of Guatemala, Honduras, and El Salvador just visited U.S. President Barack Obama to urge him to change course in combatting the flood of illegal immigrants into the United States. The three heads of state recommend the U.S. president focus on fighting violent gangs in Central America, rather than protecting the border and deporting illegal immigrants.

Problem: Neither set of policies will work. Desperate people will find ways around, under, or over the proposed "Great Wall of Mexico," just as they do with stretches already built (and then there are the sea routes). The U.S. has already spent $250-million over the past decade and built 1,000 kilometers of new walls, added cameras, sensors, and drones, and yet the crossings continue.

Story continues below advertisement

As for throwing American military resources into a violent, corrupt environment to fight gangs, that will do little good, as "corrupt" is the operative word. People who recommend this should ask themselves this question: Who gets to keep the weapons? Rogue military and police units thrive in Central America.

Such measures may provide short-term relief before they are corrupted and ways around barriers found. But the long-term solution is legal, regulatory, and economic reform to increase the economic freedom of the residents of Central America and provide opportunity for all.

The lack of economic freedom propels the flood of illegal immigrants. Even in relatively peaceful times, people flow across the border to seek economic opportunity. The same lack of opportunity also drives young men into gangs, propelling the violence that Central Americans flee.

A recent study by Indra de Soysa and Krishna Chaitanya Vadlamannati of the Norwegian University of Science and Technology published by the Fraser Institute show that economic freedom reduces conflict by creating more profitable alternatives.

While gangs and drugs catch headlines in Canada and the United States, the truth is few young people here consider the dangerous options of drug running and gang warfare as a route to wealth. Some will, nonetheless, due to personal inclination, family and friend connections, perverse role models, or their own sense of lack of opportunity, but this tiny minority doesn't threaten most people's everyday lives.

But in much of Latin America and places like Afghanistan the only path to wealth (or even economic comfort) is criminal activity. Grasping elites manipulate law and regulation to deprive the poor and disposed of opportunity.

Guatemala, Honduras and El Salvador all score miserably on the Fraser Institute's economic freedom of the world index, particularly on legal and property rights and regulation. You want to compete against the elite, and the laws and regulations will stop you.

Story continues below advertisement

The Canadian left promotes socialist alternatives but these fare no better. In the Fraser Institute index for legal system and property rights, Guatemala ranks 101st, Honduras, 99th, and El Salvador, 103rd, compared to the populist heavens of Bolivia, 104th, and Venezuela, 122nd out of 152 nations in the index.

But don't listen to us. According to Transparency International's corruption index, the populists fare equally badly: Bolivia is 106th and Venezuela, with its soaring murder rate, is 160th, compared to Guatemala, 123rd, Honduras, 140th, and El Salvador, 83rd of the 179 nations in the index.

Sadly, populists use state power and socialist rhetoric to transfer power and privilege from one elite to another, with an awful lot of overlap.

One Latin American nation has firmly turned to economic reform, Chile. It ranks 36th for legal system and property rights and 22nd on the corruption index, roughly equivalent with many European nations. It also ranks in the top 10 of the overall economic freedom index.

This shows in economic performance. Since Chile turned to free markets in the mid-1970s, Chile's per capita GDP is almost four times larger. Opportunity and open markets flourish. El Salvador, which had about the same per capita GDP in the mid-1970s, grew less than 30 per cent.

Venezuela, remarkably with its resources, is actually poorer than it was 40 years ago while Bolivia, Honduras, and El Salvador all have minimal rates of growth compared to maximal rates of poverty and violence.

Story continues below advertisement

The difference in violence is striking: for Chile three murders per 100,000 people; Bolivia, 12; Guatemala, 40; El Salvador, 41; Venezuela, 54; and Honduras, 90.

The real solution to the flood of illegal immigrants from Central America is not higher walls or more guns to combat gangs, but to follow the path of Chile. Increased economic freedom, open to all not just the elites, would give youth an alternative to gangs and create the prosperity, opportunity, and calm that will keep people at home.