The Mexican National Guard had just captured the son of notorious drug kingpin Joaquin “El Chapo” Guzman — then suddenly, they needed his help.

Within two minutes of soldiers raiding the Culiacán compound of Ovidio Guzman on Oct. 17, the Sinaloa cartel had already begun amassing an army of gunmen outside — and soldiers handed the kingpin’s son a cell phone and pleaded for him to call his brother.

“Tell him to stop everything,” one soldier is heard saying in Spanish on dramatic video of the raid. “Tell him to retreat.”

But his brother, Archivaldo Guzman, refused, instead ordering a full-scale assault against the National Guard, government offices and the city itself that forced the soldiers to retreat just hours later — and to leave Ovidio behind.

The dramatic footage of the botched operation was released Wednesday as the country’s leadership scrambled to explain how its attempt take down Ovidio instead resulted in bloodshed across the city that saw 13 people killed and dozens of inmates escape from prison.

In a press briefing, Mexican Security Minister Alfonso Durazo called it a “tactical stumble” that he admitted helped reestablish the clout of the cartel — but insisted officers had to free Ovidio to keep the peace.

“What could have become a scene of war and the shedding of innocent blood was resolved in favor of a return to peace and protecting the population,” Durazo said.

With Mexican President Andres Manuel Lopez Obrador looking on, Durazo and other security officials gave a blow-by-blow account of the raid and its aftermath.

The operation began when a Mexican judge signed a warrant to have Ovidio arrested — based on an extradition order to bring him and his brother to the US to face drug trafficking charges.

A contingent of 35 National Guard troops set out to capture the 20-something narco scion around 2:30 p.m., authorities said.

Video footage from one of the soldiers’ helmet cam shows soldiers moving in on the residential compound. They come under fire but make it inside.

At 3:15 p.m., they found Ovidio inside with his gal pal, their two daughters and two guards, and took them into custody at gunpoint — before imploring him to make the failed call to Archivaldo.

Then outside, chaos erupted.

Durazo said Archivaldo was behind the counter offensive that killed more than a dozen and left sections of the bustling city looking like a war zone.

Archivaldo “was one of those leading the mobilization of various criminal elements in Culiacan,” Durazo said.

Cartel gunmen had surrounded the residential complex and declared all-out war against the city.

Eights minute after the call to Archivaldo, the first soldier was wounded.

Cartel thugs hijacked cars and city buses to close off sections of the city, torching vehicles, bridges and toll booths in an open skirmish with the Mexican troops that lasted several hours.

Gunmen launched attacks on the guard in at least six locations.

A major gun battle took place in the Tres Rios section of the city, and the gunmen also launched an assault on a local prosecutor’s office.

Another video clip released Wednesday shows a soldier with his left leg obliterated below the knee after one exchange with the gunmen.

Adding fuel to the fire, there was a prison break at the Aguaruto Penitentiary in the middle of the fighting.

Sixty-one inmates got free — 49 of them still on the loose.

Meanwhile, footage showed Ovidio and his body guards being told to get on their knees and face the wall inside the compound, as soldiers tried to figure out their next move.

“Stay calm, stay calm,” one of the soldiers is heard saying on the video.

With Mexican leaders now aware of the rapidly spiraling situation, the decision on what to do was working its way up to the top.

At 6:49 p.m., national security officials called off the operation.

The National Guard withdrew, licking their wounds — and leaving their prized prisoner behind.

The failed raid proved to be a huge embarrassment for Mexican officials, and demonstrated that the Sinaloa cartel — named for Culiacan’s province — still wields tremendous influence and power in the region.

El Chapo ruled over the bloody cartel for decades, turning it into one of the country’s most feared drug empires.

He also proved elusive — twice escaping from prison before finally being nabbed for good and extradited to the US in 2017.

He was convicted on a slew of drug trafficking charges in Brooklyn federal court earlier this year and sentenced to life behind bars.

Since his departure, El Chapo’s sons — Ovidio, Archivaldo, and their two brothers, Ivan and Jesus — have taken a more prominent role in running the cartel, authorities said.

An indictment unsealed in February charges Ovidio and Archivaldo with distributing cocaine, methamphetamine and marijuana across the US border, and Mexico agreed to capture the reputed young kingpin.