SAN FRANCISCO (AP) — Federal officials said Wednesday that Chevron Corp. has agreed to pay a nearly $3 million fine and spend $160 million on environmental improvements and upgrading oil refineries to resolve allegations the company violated pollution laws.

The U.S. Department of Justice said the agreement ends investigations in four states where Chevron’s refineries caught fire or released harmful chemicals. The settlement calls for it to spend $10 million on environmental projects in those four states: California, Mississippi, Utah and Hawaii.

The San Ramon, California-based company agreed to spend $150 million upgrading refineries throughout the country.

DOJ said the $2.95 million fine will resolve several regulatory investigations, including the 2013 explosion and fire in Pascagoula, Mississippi, that killed a Chevron worker and a 2012 fire at its Richmond, California, facility that prompted 14,000 residents to be evacuated.

“As part of this settlement, Chevron U.S.A. Inc. has agreed to significant investments at its refineries to enhance the safety and reliability of operations,” company spokesman Braden Reddall said. “We believe these measures build on existing efforts to enhance safe practices at Chevron refineries.”

Chevron in 2013 paid $2 million in fines and restitution and pleaded no contest to six charges related to the Richmond fire, which sent thousands of residents to hospitals, many complaining of respiratory problems. Chevron entered the plea to charges filed by the California Attorney General’s Office and the Contra Costa District Attorney’s Office, including failing to correct deficiencies in equipment and failing to require the use of certain equipment to protect employees from potential harm.

It also agreed to spend $20 million on improving the Richmond facility to settle claims made by California regulators.