At least seven people were injured when an attempt to illegally tap into a Pemex oil pipeline caused an explosion near Mexico City on Sunday.

The blast shortly before 5 a.m. sent plumes of smoke and flames hundreds of feet into the air in Tonanitla, about 25 miles north of the capital city, according to The Associated Press.

More from GlobalPost: Deadly Pemex explosion in Mexico caused by gas leak, authorities say

Five of the injured were police officers, and two worked for the fire brigade.

The 30-inch pipeline is owned by Mexican state oil monopoly Petroleos Mexicanos, or Pemex, which said the fire was under control several hours after the explosion.

Pemex said those who were injured got too close to the blaze and were hurt in a secondary explosion.

Two patrol cars were incinerated by the fire.

More from GlobalPost: Mexico's president stresses need to modernize Pemex

Illegal pipeline taps are a frequent menace to Pemex, which claims it loses hundreds of millions of dollars a year to oil theft.

In January, 37 people were killed at Pemex's Mexico City headquarters when an accumulation of gas in its basement ignited.

A Pemex gas distribution plant in the northern city of Reynosa exploded in September 2012, killing another 30 people.

Agence France-Presse contributed to this report.