According to the DEA, Mexico produced some 111 metric tons of heroin in 2017 — 90 percent of which ended up in the US. And the Big ­Apple is feeling it. In New York City, during 2017, there were 771 fatal overdoses attributed to the drug, up from 561 two years earlier. Nationally in 2017, 580 new heroin addicts were minted each day, helping to fund the $50 billion that Mexico’s illegal heroin trade is said to generate.

Author Don Winslow, 65, has devoted 20 years to writing a trilogy of deeply researched novels centering on the Mexican drug cartels. His final entry in the series, “The Border” (William Morrow), comes out this week.

He has interviewed cartel members, killers and law enforcers; viewed videos of cartel-sponsored murder and torture; he has heard about entire families being tossed from bridges and cartels co-opting Mexican armies to create their own militias.

Here Winslow tracks the path from the poppy fields of Mexico to the streets of New York City.

Step 1:

Heroin begins as a poppy plant, often grown on small farms throughout the Sierra Madre mountains in western Mexico. Local teenage girls, chosen for their delicate hands and known as razores, walk through the fields wearing pinkie rings outfitted with razor blades. “They use their blades to cut the flower pods and squeeze out the opium gum,” said Winslow. “The farmer collects the gum and sells it to a cartel.”

Approximate value: $300 for gum to make a kilogram of heroin

Step 2:

The gum is transported, sometimes under the protection of armed guards, to nearby labs. Home-taught heroin makers transform it into the drug via a cooking process, employing various types of acids. Spikes of fentanyl, a powerful synthetic opioid, ramp up potency. It takes several hours to produce a shipment of heroin. The powder is weighed, wrapped in vacuum-sealed plastic and fashioned into brick-shaped packages. At this point, it is 90 percent pure.

Step 3:

A tractor-trailer pulls up outside the lab. “Cartel people, perhaps aided by the Mexican military or police, load the truck,” said Winslow. “As a cover, it could be carrying any commodity — sugar, sacks of limes, canned tomatoes. There are guys whose entire job is crafting devices that can be used to hide drugs. They’re very artistic and they have machine shops for making these things. There could be false bottoms on select tomato cans. Or they might outfit the ­[entire] truck with a false bottom.”

Step 4:

The shipment will most likely be headed to one of three border crossings — Laredo, Texas; El Paso, Texas; or San Diego, Calif. — that lead directly onto major interstates. The Mexican crossings are each controlled by a different cartel family, and traffickers pay 3 to 5 percent of the shipment’s value to pass through.

In some situations, said Winslow, “a decoy truck might be loaded with marijuana. A crooked border agent pulls over that truck and the truck full of heroin drives right through. The driver of the truck with marijuana knows he will go to jail for a couple of years and he’ll be paid around $75,000 for doing it.”

Step 5:

En route to New York, the driver will make as few stops as possible. “As he nears the mill where the heroin will be delivered, the driver convenes with a representative who has a small truck or car,” said Winslow. “The [driver] with the smaller vehicle will take the tomato cans that had been loaded with heroin. Then he drives to the heroin mill and the trucker from Mexico delivers his shipment of ­[actual] canned tomatoes.”

Step 6:

The drug mill is often situated inside a middle-class apartment building, and frequently ­ under control of gangs. The kilo bricks of heroin might be cut by as much as 50 percent with baby powder or starch and divided into dime-bags, which sell for $10 each and contain .05 to .10 grams. The heroin is cut at a prescribed amount in order to maintain integrity for the cartel: “If you’re McDonald’s, you want your hamburgers to be consistent,” said Winslow. “That’s what the traffickers go for.” Bags are stamped with brand names such as Predator, Obama Care or Redrum.

Approximate value: $300,000 per kilogram

Step 7:

Gang members ferry heroin to dealers around New York City and in opioid hotbeds such as Kingston, NY. Before delivering the product to customers, retailers may cut it again to bring the value up and the purity down to as little as 25 percent. But if they dilute the drug too much, they’ll be cut from the pipeline. “They won’t get any more heroin and won’t be able to continue selling,” said Wins­- low. “This is business.”

Approximate value: $450,000 per kilogram