BP Plc's U.S. subsidiary has agreed to pay $50 million (31 million pounds) in civil penalties to the state of Texas for pollution from its Texas City refinery, including the deadly March 2005 explosion, state Attorney General Greg Abbott said.

The fine is equal to the amount BP Products North America paid in 2009 to the federal government for pollution from the explosion, which killed 15 workers and injured 180 other people.

The agreement comes as BP is marketing the 406,540 barrel-per-day (bpd) Texas City refinery, which accounts for 2.2 percent of U.S. refining capacity.

In addition to the $100 million in fines paid for pollution stemming from the refinery, BP has paid the U.S. Occupational and Safety Administration $71.6 million for worker safety violations and over $2 billion settling legal claims from the explosion.

The agreement reflects the state's commitment to protecting air quality and holding polluters accountable for illegal emissions, Abbott said.

The agreement must be approved by a state court judge in Austin, Texas, before it will take effect. The court must wait 30 days after the agreement is made public before it can act.

Unlike the federal penalties, which were paid after BP pleaded guilty to violating the U.S. Clean Air Act, the London-based energy giant admits no liability for the pollution, which also includes emissions made five years after the explosion.

BP does not admit liability and enters into this judgement because of the uncertainty and costs of litigation, according to the agreement to be submitted to the court.

In a statement, the company said it was pleased with the agreement.

BP has maintained a steady focus on improving safety and compliance at Texas City, and this agreement is an important milestone in the progress of operations at the facility, the company said in a statement.

In 2007, after a two-year investigation, the U.S. Chemical Safety Board found BP had failed to maintain critical safety systems due to budget cuts imposed to meet corporate financial goals after a wave of mergers, and had ignored warnings of a catastrophic disaster at the refinery in the years before the 2005 explosion.

Since the blast, BP has spent over $1 billion upgrading the refinery and drawn praise for efforts to improve safety at its U.S. refineries.

A spokeswoman for the United Steelworkers union, which represents hourly workers at the BP refinery, said the fine BP agreed to pay on Thursday should serve as a warning for refiners to focus on process safety.

BP learned this lesson the hard way, said USW spokeswoman Lynne Baker. Since then BP has made improvements in its safety systems, but the continued emissions violations show it still needs to keep focussing its attention on process safety.

In February, BP said it wanted to sell the Texas City refinery along with its 265,000 bpd Carson, California, refinery.

In addition to the 2005 explosion, Thursday's agreement covers more 72 emissions in excess of BP's operating permits, including a 40-day breakdown in 2010 during which 500,000 pounds of pollutants were released.

Of the $50 million, $500,000 will go directly to the attorney general's office for costs of bringing a lawsuit against BP in 2009 and the rest will go to the state treasury.

(Reporting by Erwin Seba; editing by Jim Marshall)