MEXICO CITY — Gunmen killed 15 people in a mass shooting at a drug rehabilitation center in the northern border state of Chihuahua in what was apparently a feud between drug gangs, the Mexican authorities said on Wednesday.

The attack, which occurred late on Tuesday in the state capital, also called Chihuahua, was “related to drug distribution and the feud between the Mexicles and Aztecas gangs,” the state prosecutor’s office said its preliminary investigation had found.

Carlos Huerta, a spokesman for the prosecutor’s office, said four gunmen carried out the attack.

The Aztecas are armed enforcers for the Juárez drug organization, and they have fought longstanding turf battles with the Mexicles in the border city of Ciudad Juárez, across from El Paso, Tex.

Drug gangs have been known to use rehab centers to recruit addicts, and rival gangs sometimes assault the centers. The deadliest attack on rehab centers also occurred in Chihuahua, in 2010, and resulted in the deaths of 19 people.