Buy an avocado, boost a Mexican drug lord? Soon enough, it seems.

Reports from south of the border say Mexican avocado farmers are taking up arms to protect their increasingly valuable crop from the country’s ­rapacious cartels, always on the lookout for a quick buck.

But considering the ease with which cartel gunmen dispatched the Mexican army in a pitched battle in Sinaloa state this month, one would guess that the odds don’t favor the ­avocado farmers.

Or Mexico itself, for that matter — and this has ominous ­implications for the United States, too.

Flush North Americans — think millennials, in particular — love avocados; they will pay top dollar for them, which sets the market into motion. Most often this means good things. But not always.

Think cocaine and other ­illicit drugs.

As with avocados, drug dollars follow demand: A recent RAND Corporation study reports that Americans spent just shy of $150 billion on illegal narcotics in 2016. The bulk of this money goes to Mexico, which also has become a major conduit into the United States for synthetic opioids like Chinese-manufactured fentanyl, upping the cartels’ take.

Americans, in other words, love their illegal chemicals, they have the ready cash to indulge themselves — and they are not particularly mindful of the consequences of this for others.

Hence the emergence of the Mexican drug cartels, not the sole supplier of the American drug market, but pretty much at the top of the list. Mexico’s fragile political institutions, and its long history of overtly corrupt local government, made it fertile territory for the rise of extra­legal quasi-governments.

The recently concluded US federal trial of Joaquin Guzman — “El Chapo” in the headlines — revealed the extent to which the Sinaloa Cartel he once headed has insinuated itself into Mexico’s power structure.

Guzman is in US federal prison now, presumably for life, but the cartel is chugging along. On the small end of the scale, it is Sinaloa gunmen who are cornering the avocado trade — while on the other, the organization is one of the globe’s major players in illegal drugs, other organized crime and money-laundering.

It is not to be trifled with, as the Mexican army discovered this month when it took two of Guzman’s sons into custody — igniting an eight-hour battle with Sinaloa gunmen in the city of Culiacan. The gun battle ended with an ignoble surrender of government troops and the release of the prisoners.

Mexican President Andrés Manuel López Obrador explained: “Many people were at risk, and it was decided to protect people’s lives. I agreed with that.” He seemed not to have had much choice.

It also seems that the matter of who controls the Mexican state of Sinaloa effectively was resolved in armed conflict — and it isn’t AMLO.

The implications of this are obvious. Mexico just failed a fundamental test of governmental legitimacy: It is either unable, or unwilling, to protect its citizens from organized lawlessness. (The avocado farmers, of course, already knew that.)

And this, in turn, ratifies a warning from US Joint Forces Command that Mexico is slipping toward national collapse — and this was before government troops were losing all-out gun battles with criminals.

It doesn’t take much imagination to anticipate what such a collapse would mean for the United States. A legitimate refugee crisis would dwarf the manufactured border chaos that convulsed American politics this year. And it remains that Mexico is America’s third-largest trading partner, amounting to some $557 billion in business in 2017.

Potential solutions are elusive. Enhanced law enforcement stands only to drive up drug prices and cartel profits. And a more radical approach — attempting to remove profits through drug legalization — would encounter so many legal, cultural and moral barriers in the United States that it is an ­effective nonstarter.

So the crisis is likely to proceed.

But as it does, don’t lose sight of one core truth: America is, and has long been, the world’s largest importer of illegal drugs, and Americans aren’t being forced to use them.

As the philosopher Walt Kelly once noted: “We have met the enemy, and he is us.” Mexico likely wouldn’t disagree.

Twitter: @RLMac2