Updated

Thousands of National Guard troops stormed a Venezuelan prison Friday seeking to disarm inmates days after a bloody riot, setting off gunfights with resisting inmates that left at least two soldiers dead and 18 wounded.

Bursts of gunfire erupted inside the El Rodeo I prison while hundreds of inmates' relatives wept desperately outside, some of them shouting, "Help them!"

Troops used tear gas and a water cannon to keep the relatives back from the prison as ambulances emerged to carry out the wounded.

Vice President Elias Jaua said one National Guard soldier died and 19 were wounded. Information Minister Andres Izarra said later on Twitter that another National Guard soldier had died.

Officials did not mention any casualties among the inmates.

"Part of those who are incarcerated have resisted," Deputy Justice Minister Nestor Reverol told state television, saying that some of the troops were shot with high-powered weapons. He said they were in a prison tower and had refused to come down.

A military helicopter circled overhead while gunfire rang out inside the prison in what appeared be shootouts. A fire broke out in a prison tower, and then died down as the gunfire persisted.

"We can't permit anarchy in the penitentiary," Reverol said as the gunshots continued to be heard. "We demand the inmates change their attitude."

More than 3,500 troops were taking part in the operation in El Rodeo I and El Rodeo II prisons in Guatire, east of the capital, Caracas, and had about three-quarters of the prison population of more than 5,000 inmates under control, Reverol said.

The violence erupted as troops were carrying out a search operation to disarm inmates, National Guard Gen. Luis Motta Dominguez told state television. A riot in the prison on Sunday left 21 inmates and a visitor dead.

Friday's clashes were the latest in a series of violent outbursts in Venezuela's severely crowded prisons, where rival gangs often fight for control of cellblocks and sell weapons and drugs with the help of corrupt prison guards.

As the gunfire raged in the prison Friday, inmates' relatives expressed anguish.

"We have our hands tied," said Cecilia Mijares, 49, whose nephew was among the prisoners inside. "This started early this morning. Listen to the gunfire."

Ambulances drove in and out of the prison compound. The National Guard's water cannon truck crashed into one of the ambulances that was leaving the prison, and another ambulance pulled up to help. It was unclear if anyone was hurt in the collision.

Government officials said the purpose of the operation was precisely to safeguard the lives of inmates.

"The only thing we want is to guarantee the fundamental rights of the inmates," Reverol said.

Jaua said the government's message for inmates' families is that "the intervention we're carrying out today isn't to massacre their relatives."

"It's to protect the lives of more than 5,000 inmates," Jaua said in a televised speech.

A total of 124 deaths were reported in Venezuela's prisons in the first three months of this year, a 22 percent increase over the same period last year, according to the Venezuelan Prisons Observatory, a watchdog group.

Carlos Nieto, an activist who monitors prison conditions, said some inmates had told him that shootouts between troops and prisoners were continuing Friday afternoon, and that some inmates told him they had no intention of giving in.

He questioned the authorities' actions, called it the most serious incident in Venezuela's prisons "in at least 10 years."

Iris Villasmil, a pregnant 22-year-old whose husband is an inmate, said she and other relatives had been waiting outside the prison at 2 a.m. hoping they would be allowed to visit their relatives when troops arrived and used tear gas and plastic bullets to disperse them.

"This is horrible," said Ana Blanco, 50, whose 18-year-old son is an inmate. "They live in there like animals."

"I'm crying because my son is in there and I haven't been able to communicate with him, and what I hear are shots."

One woman who said her name was Maria Isabel and declined to give her last name said she was struck in the head by a soldier as he entered the prison on a motorcycle. A partly bloodied gauze pad was taped to her head.