SAO PAULO (AP) — A federal judge in Brazil has dismissed a civil lawsuit against Chevron Corp. and driller Transocean Ltd. filed in connection with a 2011 oil spill off the coast of Rio de Janeiro.

A federal court official in Rio de Janeiro Tuesday said that judge Raffaele Felice Pirro decided to dismiss the case on Friday after Chevron agreed to pay the equivalent of about $150 million in “compensatory activities.” The official, who spoke on condition of anonymity because of internal regulations, said the ruling was announced late Monday.

The prosecutor’s office said it had no immediate comment, and Chevron did not respond to an emailed request for comment.

The official said Pirro’s ruling “brings to an end” a legal battle that lasted nearly two years.

Federal prosecutors had been seeking about $20 billion in damages for an estimated 110,000 gallons (416,300 liters) of crude that seeped into the ocean near the Chevron well in Nov. 2011. The leaks resumed several months later, and the company’s production in the Frade field was suspended. The field had been producing around 62,000 barrels a day.

In Aug. 2012, Chevron said it underestimated the pressure in an underwater reservoir, causing crude to rush up a bore hole and eventually escape into the surrounding seabed. Pirro said in his ruling that Transocean had no responsibility.

On Feb. 2013, a federal court dismissed criminal charges filed against Chevron, Transocean and several of their executives because of the spill.

The two companies and 17 of their executives had been charged with “crimes against the environment” and faced up to 31 years in prison if convicted.

In April of this year, Brazil’s National Petroleum Agency authorized Chevron to resume production on six offshore wells.