Investigators have dug up 18 bodies in western Mexico after questioning nearly two dozen police officers who confessed to working with a drug cartel and led agents to a series of mass graves.

Officials said that more bodies could be found as excavation of eight graves in Michoacan state continues. Some of the bodies were gagged and showed signs of torture, and one of them was a woman, a federal prosecutors official told the AP news agency.

The discovery follows the capture of 22 police officers who, according to the official, confessed to turning two federal agents over to the New Generation drug cartel, and feeding information to the gang.

The official said the two agents were not among the bodies exhumed over the past six days.

Neither the identities of the victims nor the motive for the killings have been released, but the area in which they were located is the site of a turf war between the Knights Templar and the New Generation cartels.

Locals in Michoacan have formed self-defence groups to fight the pseudo-religious Knights Templar.

Mexican President Enrique Pena Nieto says murder rates are down even as the state deals with unprecedented level of attacks.

Despite efforts to root out corruption from police departments, many officers continue to work for drug traffickers. Last week, military and federal police moved into the Michoacan port of Lazaro Cardenas, a hub for trafficking precursor chemicals used to make methamphetamine, and dismissed the entire police force.

Other areas in western and southern Mexico continue to suffer from clashes between security forces and gangs or between rival cartel members.