Federal agents and soldiers stand guard on a road in Michoacan where officers were ambushed leaving 20 gunmen and two federal agents dead. Photograph: Str/EPA

Violent clashes across the Mexican state of Michoacan killed at least 20 gunmen and two federal police officers, the government said.

Gunmen blocked roads and ambushed police patrols in at least six different areas of Michoacan on Tuesday, the interior department said in a statement.

The department said federal agents repelled the attacks, killing 20 and wounding an unknown number of assailants. Two police officers died in the shootouts and 15 were wounded, it said.

Fighting between the Knights Templar drug cartel and federal police has been intensifying over the past week in western Mexico. At least four police officers have been killed in shootouts with gunmen in Michoacan since Thursday.

On Monday, five people were killed when gunmen opened fire on a group of community self-defence members gathered on a plaza in the Michoacan town of Los Reyes.

About 300 masked community vigilantes wearing similar T-shirts arrived at city hall in Los Reyes and announced they would take over policing the town. Minutes later three assailants opened fired on the crowd, killing three members of the self-defence group, a police officer and a passer-by, prosecutors said.

Self-defence squads have been set up in recent months in Michoacan by people who say they are fighting violence, kidnappings and extortions carried out by drug cartels.

Also on Tuesday, authorities in the northern state of Chihuahua said police found the bodies of six men in a remote village where several homes and cars were set ablaze.

A statement from Chihuahua state prosecutors said two of the victims found in the village of Mesa de la Reforma had been decapitated and all six were shot.

Four of the victims were wearing law enforcement uniforms and bulletproof vests but are not believed to have been police officers or soldiers, prosecutors said.

The bodies were found on Monday. The village is part of the town of Guadalupe y Calvo, which is in the "Golden Triangle", an area used to grow marijuana and opium poppies.