Mexico essentially legalized the country’s growing “self-defense” groups Monday, while also announcing that security forces had captured one of the four top leaders of the Knights Templar drug cartel, which the vigilante groups have been fighting for the last year.

The government said it had reached an agreement with vigilante leaders to incorporate the armed civilian groups into old and largely forgotten quasi-military units called the Rural Defense Corps. Vigilante groups estimate their numbers at 20,000 men under arms.