DALLAS - Exxon Mobil (XOM) settled air pollution violations with the Trump administration by paying a $2.5 million civil penalty and promising to spend $300 million on pollution-control technology at several plants along the Gulf Coast.

Federal officials said Tuesday that the settlement will prevent thousands of tons of future pollution, including cancer-causing benzene, from eight petrochemical plants in Texas and Louisiana.

Some environmentalists attacked the settlement as insufficient punishment for years of violations by the giant oil company, while others said it addressed excess burning or flaring of gas, a key pollution problem at Exxon plants.

Get Breaking News Delivered to Your Inbox

The deal settles allegations that Exxon violated the federal Clean Air Act by releasing excess harmful pollution after modifying flaring systems at five plants in Texas and three in Louisiana. The allegations date back more than a decade.

Exxon said it will install and increase the efficiency of the flaring systems and monitor for benzene outside four of the plants.

The Justice Department and the state of Colorado announced a smaller settlement over pollution charges against Denver-based PDC Energy (PDCE). The company will spend about $20 million to upgrade equipment and pay a $2.5 million civil penalty to the federal government and Colorado. Up to $1 million of the state's share can be forgiven if the company performs certain environmental projects.

Patrick Traylor, a former energy industry lawyer hired by new EPA Administrator Scott Pruitt, said the settlements show that the Trump administration will enforce environmental laws "with prudence and with excellence."

Traylor said the deals bring "two very well-respected companies" back into compliance with environmental laws. "Now they can continue their work of driving economic growth," he said.

Environmentalists said the civil penalty against Exxon was far too small given the duration and seriousness of the violations of the federal Clean Air Act.

"The fossil-fueled Trump administration letting Exxon Mobil off the hook with a slap of the wrist," said Lindsay Meiman of 350.org, an environmental group that emphasizes lower emissions of greenhouse gases. She said the deal would embolden Exxon and other companies to continue to pollute.

However, the director of a group that successfully sued Exxon praised the deal -- even while calling the $2.5 million penalty "weak" -- because it forced Exxon to spend $300 million on reducing pollution.

"This enforcement case was in the works for many, many years" before the Trump administration, said Luke Metzger of Environment Texas. "It's a very good settlement" that addresses issues his group raised in a lawsuit over Exxon's refinery complex in Baytown, Texas, including excessive flaring of natural gas and inadequate monitoring of emissions.

In April, a federal judge ordered Exxon to pay the government nearly $20 million after Environment Texas and the Sierra Club sued over the release of tons of pollutants at Baytown. Exxon is appealing the ruling.

Exxon spokesman Aaron Stryk said in a statement that the company "worked closely" with EPA "to address concerns about flaring and opportunities to improve flaring efficiency at our U.S. chemical sites." He said the $300 million investment would increase flare efficiency at the petrochemical plants, among the biggest in the world.

The plants are in Baytown, Beaumont and Mont Belvieu, Texas, and Baton Rouge, Louisiana. As part of the settlement, Exxon will spend $1 million to plant trees in Baytown.

Exxon Mobil, based in Irving, Texas, reported last week that it has earned $11.3 billion so far in 2017, an 84 percent increase over the same period last year.