(Updates death toll, adds details) SAN SALVADOR, Jan 6 (Reuters) - Twenty inmates died when youth gang members attacked a guard and other prisoners at an overcrowded prison in El Salvador before security forces regained control, police said on Saturday. Members of the infamous "18" gang attacked a guard on Friday, sparking the trouble at the Apanteos prison in the western department of Santa Ana, a police spokeswoman said. The gang members then assaulted other inmates with blunt instruments, breaking down walls to get at them, a prison official said. Most of the dead were common criminals. Police officers and soldiers surrounded the prison before the authorities took back control after negotiations with the inmates. Brutal violence by members of the "18" gang and its deadly rival the "Mara Salvatrucha" is common in Central American prisons. Four inmates died in Guatemala last June in a gang fight, with one of the victims shot in a dormitory and two beaten to death with concrete blocks after their hands were cut off. Salvadoran prisons are badly overcrowded, with more than 13,000 inmates in a system built to hold fewer than 6,000.