MEXICO CITY—Policemen who were apparently protecting fuel robbers opened fire on other officers who came to investigate the theft, leaving one lawman dead and two wounded, prosecutors said Wednesday.

The Mexico State prosecutors' office said police from the town of Tepetlaoxtoc pulled up to investigate a tanker truck apparently drawing fuel from a government pipeline.

Officers from the city of Texcoco then allegedly opened fire on their colleagues, killing a Tepetlaoxtoc policeman. One officer from each side was wounded.

A bullet-ridden Texcoco patrol car was found abandoned near the scene.

The Texcoco city government issued a statement saying it would not allow the crime to go unpunished, and said the officers involved had been detained for investigation.

Mexico's state-owned Pemex oil company has suffered thousands of illegal pipeline taps, and analysts have long speculated that the thieves have been receiving help or protection from some officials or Pemex employees.

In a report in July, Pemex said 1,421 illegal fuel taps had been discovered in the first six months of this year, almost twice the 722 taps uncovered in the same period of 2012. Since drilling into the lines often occurs when pressure is lowered for maintenance or other reasons, experts have said thieves may be getting tips from inside the company about when to drill.

But there are also indications, as in Tuesday's incident, that fuel thieves my receive police protection or funnel part of the stolen gas and diesel into legitimate stations or businesses.