Officials said the slayings were the work of La Familia, a Michoacan-based trafficking group that has carried out at least 10 attacks against federal police in the state since Saturday, when authorities captured an alleged leader of the group.
Monte Alejandro Rubido, a senior federal security official, said the 11 men and one woman were off duty when they were ambushed.
He said the killers left a message with the heap of bodies that threatened federal police.
Elsewhere, he said, authorities came upon two posters warning that police faced death if "they didn't leave or line up" with La Familia, a cult-like gang that U.S. officials say has fast become one of Mexico's strongest trafficking groups.
"The La Familia Michoacan cartel is known for its violence," Rubido said at a news conference.
"We shouldn't be surprised by this type of reaction," he said.
The officers' killings represent the government's worst loss of life in a single event since President Felipe Calderon declared an army-led crackdown against drug traffickers soon after taking office in December 2006. Eight federal police officers died in a shootout in the northwestern state of Sinaloa in May 2008.
Eight soldiers were found decapitated in Guerrero state, adjacent to Michoacan, in December.
The influence of drug gangs has seeped into politics in Michoacan, a scenic belt of forested mountains and coastline that is Calderon's home state. Federal authorities arrested 30 state and local officials for suspected drug ties in May.
Rubido alleged that the same La Familia cell involved in the attacks on the officers includes a newly elected congressman who is the half brother of Leonel Godoy, the leftist Michoacan governor, and another man who ran as a Green Party candidate for Congress.
Mexico's attorney general, Eduardo Medina Mora, met with Gov. Godoy on Tuesday in what was described as a work session.
The violence in Michoacan erupted after the arrest Saturday of Arnoldo Rueda Medina, who authorities say is a ranking operative in La Familia and a close aide to its founder, Nazario Moreno Gonzalez.
Gunmen carried out half a dozen attacks against federal forces around the state Saturday, killing five.
A federal officer also was killed Monday night when gunmen fired on a convoy of federal police heading toward the port city of Lazaro Cardenas. At least six officers were wounded, according to Mexican media reports.
Calderon says government pressure has pushed drug trafficking groups to lash out at authorities and one another. More than 11,000 people have died since the crackdown began.
"We cannot, we should not, we will not take one step backward in this matter," Calderon said Tuesday.
Mexicans seem skeptical. In a new poll, more than half of respondents said they believe the government is losing the war. Only 28% said it is winning, according to the survey, published Tuesday in the daily Milenio newspaper.
Cecilia Sánchez of The Times' Mexico City Bureau contributed to this report.