Twenty-five people were killed during a prison riot and dozens were wounded when two groups of inmates waged a gunbattle inside the penitentiary while hundreds of relatives were visiting, Venezuelan officials said Monday.

The violence erupted at Yare I prison south of Caracas on Sunday, and at least one of those slain was a relative of an inmate, said Iris Varela, the government's prisons minister.

It was the latest and one of the deadliest in a series of bloody clashes that have flared in Venezuela's overcrowded prisons and become a major problem for President Hugo Chavez's government.

Varela told state television Monday afternoon that 17 of the 25 dead had been identified so far. She said some of them had been shot in the head. Forty-three other people were wounded, including 29 inmates and 14 visiting relatives, Varela said.

About 980 women who were at the prison to see inmates when the fighting broke out were still inside, she said.

Armed inmates still held control of the prison Monday night, and some of the relatives stayed inside due to fears about how security forces outside would react, said Humberto Prado, an activist and director of the watchdog group Venezuelan Prisons Observatory.

Varela indicated the situation had stabilized Monday and said authorities planned to talk with inmates "to try to impose order there."

Varela said the riot apparently began when a gun went off while armed inmates were talking in a workshop and administrative area. She said those behind the killings "are going to have to answer for this."

Carlos Nieto, an activist who monitors human rights in Venezuelan prisons, said the gunbattle lasted about four hours and involved groups fighting for control.

Yajaira Morroy, the mother of a 27-year-old inmate at the prison, said her son suffered a gunshot wound in a leg and had been trying to help a relative of another inmate who was wounded and then died. She said her son managed to reach a guard post and was taken to a hospital.

Morroy said during a telephone interview that the situation inside the prison had calmed and that some relatives who had been stranded inside were able to come out. But she said that armed inmates were in control and that National Guard troops had not gone inside.

Outside the prison, inmates' relatives wept while they waited for word about the men inside.

Violence has recently worsened inside Venezuela's prisons, where inmates often obtain weapons and drugs with the help of corrupt guards.

Nieto said the riot shows that the "most serious prison problem, the weapons possessed by inmates, hasn't been solved." He noted that less than a month ago, another bloody riot erupted at another prison in Merida state. While officials said the death toll was 11, the Venezuelan Prisons Observatory said it had reports that about 30 people were killed.

Nationwide, the group says that 560 people were killed in Venezuelan prisons last year and that the pace of the violence increased during the first half of this year, with at least 304 inmates killed.

Venezuela currently has 33 prisons built to hold about 12,000 inmates, but officials have said the prisons' population is about 47,000.

More than 3,000 inmates fill Yare I prison, which was built to hold 750, according to the Venezuelan Prisons Observatory.

Following a deadly armed uprising last year in the prisons El Rodeo I and El Rodeo II, just outside Caracas, Chavez announced plans for changes to the country's troubled penal system including building new prisons, improving conditions and speeding trials for inmates who have yet to be sentenced.

Since then, Chavez has approved funds to repair and renovate prisons. Varela has said the government has started activities for inmates, allowing them to attend classes and to prepare food that they sell.

Chavez's political opponents and groups that monitor inmate rights have criticized the government's response as inadequate, and outbursts of violence have continued, becoming a campaign issue ahead of the country's Oct. 7 presidential election.

Opposition presidential candidate Henrique Capriles lambasted the government's efforts in a message on Twitter Monday, noting that hundreds of inmates have been killed since Chavez created a new ministry to oversee prison issues last year. Capriles called Chavez's pledges to improve the prison system "another big lie."

In one case in May, the government shut down Caracas' La Planta lockup and moved inmates to other prisons following a three-week uprising that pitted armed inmates against troops. Officials said that two people were killed in the gunfire, including a man who lived near the prison and was hit by a stray bullet, and that five others were wounded.