TEGUCIGALPA, Honduras — Honduran President Porfirio Lobo ordered the militarization of the country's main prison on Saturday after a gunfight there left at least three gang members dead and 12 people injured, including three guards.

The aim of the measure, which involves putting soldiers in charge of the prison's security, is to "end the reign of criminals in our prison system, which has done so much damage to our society," Lobo said in a statement.

Police spokesman Miguel Martinez said members of the "Barrio 18" gang fought with other inmates in Honduras' National Penitentiary, which houses 3,351 inmates and is located about 10 miles (15 kilometers) north of the capital, Tegucigalpa.

Three gang members were killed and nine injured, director of penitentiaries Jose Simeon Flores said in a press conference, adding that three guards were wounded by gunfire.

"The gang members used AK-47s, according to them, to defend themselves from other prisoners. They also exploded a fragmentation grenade," Flores said.

The army and police are now in control of the prison, he said. Authorities are carrying out a "cell-by-cell review to find out what happened."

Dr. Juan Ayestas, chief of emergency surgery at the Hospital Escuela in Tegucigalpa, said one of the dead inmates had a gunshot wound to the head.

A contingent of 70 soldiers and police was sent to guard the Hospital Escuela, where injured inmates were taken, for fear that their gang would try to free them.

"We have detected cars with armed men inside passing by the hospital and for this reason we are increasing security measures to avoid a tragedy," Martinez said.

The riot and militarization of the prison comes a day after the release of an Inter-American Commission on Human Rights report that said inmates control Honduras' 24 prisons because the state has abandoned its role in rehabilitating people convicted of crimes.

The commission said that one consequence of the state's abandonment of the prisons is the rise of so-called systems of "self-governance" that are headed by inmates known as "coordinators." The coordinators are picked by the inmates and set rules for the prison, including disciplinary measures.

The report said that some prisons are so poorly guarded that the inmates could escape if they wanted to, but don't because they don't want to upset the balance.

The commission conducted the report following a fire last year at the Comayagua prison that killed 361 inmates.

Honduran prisons operate on a Lord-of-the-Flies system that allows inmates to run businesses behind bars, while officials turn a blind eye in exchange for a cut of the profits they say is spent on prison needs.

Authorities say they carry out three searches a month in the country's state prison and find a large quantity of arms, from guns to knives and machetes. Guards are bribed to let them bring the arms into the prison.

The government says there are 12,263 people incarcerated in Honduras even though its prisons can only hold 8,120 inmates.