Rival gangs earn millions of dollars a year from stealing crude oil, diesel and gasoline and selling it on a thriving black market. With Brazil mired in one of its worst recessions, sourcing crude in this way has become desirable and lucrative.

The thieves' methods range from hijacking tanker trucks to tapping the company's more than 11,000 kilometers of pipelines - and processing stolen crude at their own secret refineries.

"Not even Petrobras knows exactly how much is being stolen," said Giniton Lages, the Rio police chief who led the investigation at Duque de Caxias. "It's a huge business, moving millions of reais."

Police suspect an inside job: the taps and pipes near the Duque de Caxias refinery were so precisely engineered that investigators concluded the thieves must have had help from inside Petrobras.

"They knew what type of fuel was inside each pipe and what was the ideal point to place a tap without the change of pressure in the tube raising the attention of the company's security system," Lages said.

Petrobras, whose production of about 2.8 million barrels a day makes it one of the world's top 10 oil companies, said it was working with police to identify any employees or ex-employees that may have been involved in the crimes.