(Adds details of the violence in Culiacan)

By Dave Graham and Lizbeth Diaz

MEXICO CITY, Oct 17 (Reuters) - Heavily armed fighters surrounded security forces in a Mexican city on Thursday and made them free one of drug lord Joaquin 'El Chapo' Guzman's sons, after his capture triggered gunbattles and a prison break that sent civilians scurrying for cover.

Security Minister Alfonso Durazo said a patrol by National Guard militarized police first came under attack from within a house in the city of Culiacan, 1,235 km (770 miles) northwest of Mexico City.

After entering the house, they found four men, including Ovidio Guzman, who is accused of drug trafficking in the United States.

The patrol was quickly outmatched by cartel gunmen, however, and it was withdrawn to prevent lives being lost, the government said. Simultaneously, fighters swarmed through the city, battling police and soldiers in broad daylight. They torched vehicles and left at least one gas station ablaze.

"The decision was taken to retreat from the house, without Guzman, to try to avoid more violence in the area and preserve the lives of our personnel and recover calm in the city," Durazo told Reuters.

The reaction to Guzman's capture was on a scale rarely seen during Mexico's long drug war, even after his more famous father's arrests. The chaos was continuing as night fell.

A large group of inmates escaped from the city prison. Residents cowered in shopping centers and supermarkets as gunfire roared. Black plumes of smoke rose across the skyline.

Families with young children left their cars and lay flat in the road. Bullets cracked up ahead. "Dad, can we get up now?" a small boy said to his father in a video posted on Twitter.

"No, stay there on the floor," the man replied, his voice trembling.

Cristobal Castaneda, head of security in Sinaloa, told the Televisa network that two people had been killed and 21 injured, according to preliminary information. He said police had come under attack when they approached roadblocks manned by gunmen. He advised residents not to leave their homes.

Story continues

It was not immediately clear if members of the patrol were harmed in the standoff. Reuters TV showed scenes of at least three bodies lying next to cars on the street.





WARNED OF REPRISALS

The chaos in Culiacan, long a stronghold for the Guzmans' Sinaloa cartel, will increase pressure on President Andres Manuel Lopez Obrador, who took office in December promising to pacify a country weary after more than a decade of drug-war fighting. Murders this year are set to be at a record high.

Thursday's events follow the massacre of more than a dozen police in western Mexico earlier this week, and the killing of 14 suspected gangsters by the army a day later.

Falko Ernst, senior analyst for the International Crisis Group in Mexico, said the release of Ovidio Guzman set "a dangerous precedent" and sent a message that the state itself, including the army, could be blackmailed and was not in control.

Presumed cartel members apparently intercepted a radio frequency used by security forces, one video showed, warning of reprisals against soldiers if Guzman was not freed.

A state police spokesman confirmed to Reuters that several prisoners escaped from a prison during the chaos. Video footage showed a group of at least 20 prisoners running in the streets. It was not immediately clear how many had escaped.

"They are freeing them," a panicked woman said in the video apparently filmed from an tall building. "No we can't go outside!" she said as other voices debated making a dash for their car.

In another video, a man driving repeatedly shouted: "There is a big gunfight," before taking a sharp turn and leaving his car at a gas station to take cover. His voice then became inaudible because of the rattling roar of automatic gunfire.

'El Chapo' Guzman led the Sinaloa cartel for decades, escaping from prison twice before being arrested and extradited to the United States. He was found guilty in a U.S. court in February of smuggling tons of drugs and sentenced to life in prison.

He is believed to have about 12 children including Ovidio. The U.S. Department of Justice unveiled an indictment against Ovidio and another of the brothers in February, charging them with conspiracy to distribute cocaine, methamphetamine, and marijuana in the United States.

The indictment gave Ovidio's age as 28, and said he had been involved in trafficking conspiracies since he was a teenager.

Jose Luis Gonzalez Meza, a lawyer for the Guzmans, told news network Milenio that Ovidio had been in touch with the family and said he was free. (Additional reporting by Stefanie Eschenbacher; Writing and additional reporting by Frank Jack Daniel; Editing by Raju Gopalakrishnan)