The worst air quality in the United States is in California, a state known for its efforts to raise environmental standards, cut greenhouse gas emissions, and combat climate change.

California has the highest ozone levels of any state, according to the American Lung Association's "State of the Air 2017" report on air pollution, which analyzed counties across the country based on levels of ozone and particle pollution.

The situation in California is steadily improving, but the state still lags behind the rest of the nation.

Get Breaking News Delivered to Your Inbox

Three California counties — Los Angeles-Long Beach, Bakersfield and Fresno-Madera — had the worst smog levels in the entire country. More than 90 percent of California residents live in counties with unhealthy air, according to the American Lung Association.

Nationwide, the report found nearly four in ten Americans live where pollution levels are often dangerous to breathe. But overall, the number of Americans exposed to unhealthy levels of air pollution dropped to about 125 million people, down from 166 million in last year's report (which covered the period from 2012-2014).

Air pollution can cause asthma attacks, heart attacks, lung cancer, reproductive harm and premature death. Globally, the World Health Organization says 3 million people die prematurely each year from breathing polluted air, and children are especially at risk.

Why is California's ozone problem so extreme?

California's population is rapidly growing, from 15.8 million in 1960 to 39.2 million in 2016, according to the U.S. Census Bureau. Major urban areas like Los Angeles are designed around car travel. In addition, ozone is naturally produced when the sun's rays split oxygen molecules — meaning California's sunshine exacerbates its existing smog problem.

"If our city keeps getting hotter, that is going to cause higher levels of ozone," Steve LaDochy, professor of geography and urban analysis at California State University, Los Angeles, said in a statement.

Earlier this month — after criticizing President Trump's decision to pull the U.S. out of the landmark Paris Agreement on climate change — California Governor Jerry Brown signed a direct agreement with China to work together on reducing emissions and expanding trade, with an emphasis on green technologies.

"Nobody can stay on the sidelines. We can't afford any dropouts in the tremendous human challenge to make the transition to a sustainable future," Brown said. "Disaster still looms, and we've got to make the turn."