City leaders announced Thursday that Mirant Corporation has agreed to close the Potrero Hill power plant by the end of next year.

The city has spent much of the last decade trying to close the fossil-fuel plant.

Now the power company is throwing in the towel, agreeing to pay the city's legal costs and $1 million to help those suffering from childhood asthma in surrounding communities, mainly in the Bayview -Hunters Point area.

"We have some of the highest rates of asthma, the highest rates of cancer, the highest rates of anything negative that you can imagine," San Francisco Supervisor Sophie Maxwell said. "We hear about environmental justice, well this is the day."

The power company also agrees to join the city in pushing for the plant's closure if state and federal regulators oppose it, most likely on grounds that the electricity it generates is needed to supply the city.