MEXICO CITY—Armed men carried out a massacre in a Tijuana drug-rehabilitation center, Mexican authorities said Monday, showing that violence persists even in one of the few border towns where officials claim to be defeating powerful crime groups.

The attack occurred late Sunday evening when armed commandos entered El Camino, a recovery center for drug addicts, and killed 13 people with scores of automatic rifle rounds.

Investigators were gathering evidence at the scene of the attack Monday, said a spokesman for the attorney general's office of Baja California, the state where Tijuana is located.

Pictures of the scene showed military men carrying rifles and patrolling the treatment center, with several body bags visible through a metal gate at the entrance of the compound.

The bloody attack happened shortly after another weekend shooting across the Texas border in Ciudad Juárez where gunmen burst into a birthday party and killed 14 young people, including a 13-year-old girl.