The Zetas, for example, were first created as the enforcement arm of the Gulf cartel, but later turned on their former allies and have been at war with them ever since. The Knights Templar are an off-shoot of La Familia Michoacana, a cartel that was weakened after the killing of its leader in 2010.
Allegiances shift, and former rivals sometimes band together to fight emerging groups.