BEIJING (AP) — China's smog-plagued capital has announced plans to ban the use of coal by the end of 2020 as the country fights deadly levels of pollution, especially in major cities.

Beijing's Municipal Environmental Protection Bureau posted the plan on its website Monday, saying the city would instead prioritize electricity and natural gas for heating.

The official Xinhua News Agency said coal accounted for a quarter of Beijing's energy consumption in 2012 and 22 percent of the fine particles floating in the city's air. Motor vehicles, industrial production and general dust also contributed to pollution in the 21 million-person city.

Even with the Beijing ban, coal use is expected to soar in China. Coal-fired power and heating is a major generator of greenhouse gases and has helped turn China into the world's largest emitter of carbon and other heat-trapping gases.

Pressure is growing on China's central government to clean up the country's polluted environment, as discontent over smog and water and soil contamination increases among China's expanding middle class.

The central government recently listed environmental protection as one of the top criteria by which leaders will be judged.

In September, the government announced a prohibition on new coal-fired power plants around Beijing, Shanghai and Guangzhou.