Dozens of residents of the town of San Juan Ixtayopan abducted three plainclothes policemen outside a primary school and began to beat them.
During a pause in the beatings, one of the abducted policemen was interviewed on television.
With his face cut and bleeding, policeman Edgar Moreno claimed he and the other men were working undercover when they were abducted.
“We were on a drug investigation” he said.
The crowd then set upon the men again and in horrific scenes broadcast on national television, the crowd continued to kick and punch the men before dowsing two officers with gasoline and setting their bloodied bodies on fire.
The third policeman was seriously injured.
Mexico’s TV Azteca channel reported that other police units did not reach the scene to rescue their colleagues for four hours.
Residents accused the police of trying to kidnap local schoolchildren.
Child disappearances are frequent in Mexico where children are said to be either sold to rich families or sold abroad.
Federal police director Jose Luis Figueroa confirmed the three policemen were on an anti-narcotics mission in the town.
Police did not immediately arrest anyone, but are investigating.
The local area had reportedly been tense after two children had disappeared and were feared kidnapped from the school.
Mexicans frustrated by government corruption and soaring crime rates have often taken justice into their own hands.
Earlier this month in another town on the capital’s outskirts, police rescued a 28-year-old man local residents were threatening to beat to death for allegedly trying to steal a guitar and tape deck from a local community centre.