New York City sued five major oil companies, claiming they have contributed to global warming, on the same day officials announced they will sell off billions in fossil fuel investments from the city's pension funds.

Mayor Bill de Blasio said the city would be seeking billions of dollars in the lawsuit to recoup money spent for resiliency efforts related to climate change.

"We're bringing the fight against climate change straight to the fossil fuel companies that knew about its effects and intentionally misled the public to protect their profits," the Democratic mayor said in a statement. "As climate change continues to worsen, it's up to the fossil fuel companies whose greed put us in this position to shoulder the cost of making New York safer and more resilient."

Get Breaking News Delivered to Your Inbox

The city alleges the fossil fuel industry was aware for decades that burning fuel was impacting climate change. The defendants in the city's federal lawsuit are BP (BP), Chevron (CVX), ConocoPhillips (COP), Exxon Mobil (XOM) and Royal Dutch Shell (RDS.A).

Curtis Smith, a Shell spokesman, said the company believes "climate change is a complex societal challenge that should be addressed through sound government policy and cultural change to drive low-carbon choices for businesses and consumers, not by the courts."

BP declined comment, and the other three companies did not immediately comment. San Francisco, Oakland, and Santa Cruz, California, have filed similar lawsuits against oil companies.

Also Wednesday, De Blasio and New York City Comptroller Scott Stringer said they intend to divest the city's five pension funds of roughly $5 billion in fossil fuel investments out of its total of $189 billion. They say the divestment is the largest of any municipality in the U.S. to date.

"Safeguarding the retirement of our city's police officers, teachers and firefighters is our top priority, and we believe that their financial future is linked to the sustainability of the planet," Stringer said.

Clara Vondrich of the DivestInvest campaign says the city joins a movement that started about six years ago. She says hundreds of institutional investors managing assets of over $5.5 trillion have taken their money out of fossil fuel investments.

Last month, Democratic New York Gov. Andrew Cuomo announced plans to have the state pension funds also divest from fossil fuel investments. He and state Comptroller Thomas DiNapoli are creating an advisory committee to examine the way to proceed with divestment.

In November, Norway's central bank urged the Norwegian government to consider divesting oil and gas company shares held in the $1 trillion oil fund.

Vondrich said other cities and entities divesting of fossil fuel interests have included Washington, D.C., Berlin and Cape Town; insurance companies Swiss Re, Axa and Allianz; and educational institutions such as the University of Oxford in Great Britain, Stanford University in California and Trinity College in Ireland.

Philanthropies have included the Wallace Global Fund and the Rockefeller Brothers Fund -- notable because the late John D. Rockefeller grew his wealth as an oil baron.

"The Rockefeller Brothers Fund is proud to stand alongside Mayor de Blasio and Comptroller Stringer in their historic commitment to divest the NYC pension funds from fossil fuels," Stephen Heintz, president of the Rockefeller Brothers Fund said in a statement.

Brian Youngberg, a senior energy analyst at Edward Jones Investments, noted divestment is not entirely altruistic over the issue of climate change. Fossil fuel securities are underperforming and officials say the outlook for fossil fuel investments continues to be negative. "One issue facing the industry is peak oil demand," Youngberg said. "Growth will slow over the next several years."

Kyle Isakower, vice president of the American Petroleum Institute, has previously said that divestment is a "tactic of misinformed activists that is incompatible with job creation, affordable energy and economic prosperity."

"Millions of retirees and pension holders depend on income from oil and natural gas investments to live," Isakower aid." Government pension fund managers have a fiduciary responsibility to ensure the greatest return for their investors. Divestment from energy stocks is likely to reduce investment returns and is therefore not in agreement with their fiduciary responsibility."

It will take the city time to unwind the fossil fuel stakes in its massive and complex pension portfolios. New York's two largest pension funds, New York City Employees' Retirement System and Teachers' Retirement System, will immediately pursue divesting by 2022, officials said, "consistent with prudent practice and in line with their fiduciary responsibilities." The other three major pension funds will be encouraged to begin divestment as quickly as practical.

Fund trustees also will seek a legal opinion to confirm that carrying out divestment actions would be consistent with trustees' fiduciary duties to beneficiaries.