More than 100 prisoners filed out of a Venezuelan prison among National Guard troops on Thursday night after heavy gunfire erupted amid a nearly three-week standoff pitting armed inmates against security forces.

Men emerged from La Planta prison with their hands clasped behind their necks and stepped aboard trucks to be taken to other prisons. Top prisons official Iris Varela said she hoped that all of the inmates who had been resisting would finally agree to be moved to other lockups.

"It's a gradual process. We're talking. We hope that all of them come out," Varela said on television outside the prison, without saying how many inmates remained inside. "We hope to be finished with this in the coming hours to completely evacuate the prison."

Groups of inmates began to emerge from the prison after a day of clashes in which gunfire tore through the prison for more than two hours in the morning, and then continued in the afternoon.

Tear gas floated over the penitentiary during the day, and smoke billowed from a fire inside the compound.

Varela said the gunfire was due to a confrontation between inmates, but some prisoners accused National Guard troops of attacking them. Blasts were heard inside the prison, and Varela said the authorities suspected the inmates had set off grenades.

She said that according to some inmates, "there are wounded people, there are probably dead people. ... We hope not."

Outside the prison during the day, skirmishes broke out between distraught relatives of inmates and National Guard troops who used tear gas and a water cannon to drive them away. Dozens of soldiers in anti-riot gear stood guard.

The Caracas fire department said more than 70 people suffered breathing problems due to the tear gas and were treated by firefighters.

Venezuela's government is trying to close La Planta prison following two escape attempts and complaints of overcrowding, saying the facility doesn't meet standards. About half of the prison's inmates have already been transferred to other lockups, but a group of armed inmates have effectively kept the authorities out of the prison since late last month.

One inmate inside the prison told The Associated Press that prisoners weren't firing at the time and accused the National Guard troops of starting the clashes by attacking. The inmate said his first name was Darwin but declined to give his last name, saying he could face retribution.

He said inmates had met with several officials on Wednesday to discuss a peaceful solution to the standoff, but that hours later officials cut off electricity and water service to the prison. He accused security forces of firing at inmates and said some suffered light wounds, though he didn't say how many were hurt.

Prison rights activist Carlos Nieto also said that according to accounts some prisoners provided to him, National Guard troops had been involved in the violence and "the attack is from the outside in."

Government officials did not respond to those claims.

In a nearby square, Yenire Vasquez, the wife of one inmate, cried as she sat on the ground and said she hopes the prisoners aren't hurt. She said the government seemed to want to force them out.

"They're human beings," Vasquez said. "They have families. They aren't a bunch of dogs."

Some relatives of inmates have said that a group of armed prisoners has been holding out to avoid being taken to other prisons that have severe crowding problems and are far away from the courts in Caracas that are handling their cases.

The violence at the prison drew a critical response from opposition leader Henrique Capriles, who is running against President Hugo Chavez in the country's Oct. 7 election.

In a message on Twitter, Capriles called the situation at the prison "one more example of this government's failure on the issue of prisons."

Tensions at La Planta prison have risen since April 27, when Varela said the authorities foiled an escape attempt when they found a tunnel dug by inmates that led to a sewer. Three days later, gunfire erupted at the prison after what Varela described as another escape attempt.

In another incident on May 8, heavy gunfire rang out at the prison and one man in a nearby apartment was killed by a stray bullet.

Inside Venezuela's prisons, inmates often manage to obtain weapons, and violence is common. The watchdog group Venezuelan Prisons Observatory said about 560 people died in Venezuelan prisons last year, up from 476 in 2010.

Venezuela's prisons were built to hold about 12,000 inmates, but officials have said they hold about 47,000.

___

Associated Press writer Jorge Rueda contributed to this report.