October 30, 2019 | 12:56pm | Updated October 30, 2019 | 2:12pm

Dramatic video released Wednesday by Mexican authorities shows the moment Ovidio Guzman, the son of drug kingpin Joaquin “El Chapo” Guzman, was briefly captured by the Mexican military earlier this month.

The video, shot Oct. 17 from the helmet cam of a soldier, shows Ovidio being taken into custody in the city of Culiacan — only to be quickly released after wild cartel gunmen turned their rage on the city, leaving 13 dead.

With Mexican President Andres Manuel Lopez Obrador looking on, Security Minister Alfonso Durazo gave a blow-by-blow account of the botched arrest.

The footage shows soldiers moving into a building, with a young woman emerging first before the kingpin’s son, wearing a baseball cap, comes out.

With news of the raid spreading, violence had already begun to break out in the city, officials said.

The video shows soldiers ordering Ovidio to call his brother, Archivaldo Ivan Guzman Salazar, to stop the carnage — but Archivaldo refuses.

Police then put Guzman and others in his group against the wall, while the unidentified woman appears to try to intervene with the soldiers, who are heard saying, “stay calm, stay calm.”

But cartel gunmen continued turned the city into an urban war zone, including pitched gun battles with authorities.

In separate footage shown at the briefing, one soldier is seen with his left leg missing below the knee after a particularly violent exchange of gunfire.

The government later ordered Ovidio released after relatives and the drug cartel his father once ruled over threatened to continue the violence.

Durazo called the bungled bust a “hasty action” and a “tactical stumble” as he defended cutting the younger Guzman loose.

“What could have become a scene of war and the shedding seen with his left blown of innocent blood was resolved in favor of a return to peace and protecting the population,” he said.

Ovidio’s father ran the powerful Sinaloa cartel for years. He was convicted of trafficking in Brooklyn federal court earlier this year and sentenced to life behind bars.

Cartel gunmen are seen outside during clashes with federal forces following the detention of Ovidio Guzman, son of drug kingpin Joaquin "El Chapo" Guzman, in Culiacan

Cartel gunmen are seen outside during clashes with federal forces following the detention of Ovidio Guzman.

REUTERS

A burning bus, set alight by cartel gunmen to block a road, is pictured during clashes with federal forces following the detention of Ovidio Guzman, son of drug kingpin Joaquin "El Chapo" Guzman, in Culiacan

A bus burns, set alight by cartel gunmen to block a road, during clashes with federal forces following the detention of Ovidio Guzman.

REUTERS