New York City delivered a powerful blow to the fossil fuel industry by launching a climate change lawsuit against the biggest oil companies and promising to dump billions of dollars of fossil fuel stocks.

New York became the largest American city to sue Big Oil, demanding that ExxonMobil, Chevron (CVX), BP (BP), Royal Dutch Shell and ConocoPhillips (COP) pay for the cost of protecting the city from the "existential threat" of climate change.

The city on Wednesday also announced a goal to divest its $189 billion pension system from fossil fuel reserve owners within five years. New York said that would make it the first major U.S. pension plan to complete such an exit.

The lawsuit, filed on Tuesday, claims the city "already has suffered damage from climate change," including coastal erosion and tidal flooding. It said the city faces "imminent threats to its property, its infrastructure and the health and safety of its residents."

New York said it's "exceptionally vulnerable" to rising sea levels. It said resiliency projects will cost billions of dollars -- money the city doesn't have.

"It's time for Big Oil to take responsibility for the devastation they have wrought," Mayor Bill de Blasio said during a press conference.

The mayor blamed the oil industry for helping to cause extreme weather events, including deadly Hurricane Sandy. "We are going to lead the fight against climate change as if our lives depended on it -- because they do," de Blasio said.

The lawsuit cited recently-uncovered documents about what oil companies knew about the threat from climate change. A recent Harvard study concluded that Exxon (XOM) "misled the public" for more than 40 years. Exxon has rejected the claims.

Related: Exxon claims California climate change hypocrisy

In response, a Shell (RDSA) spokesman called climate change 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."

Exxon criticized "lawsuits of this kind -- filed by trial attorneys against an industry that provides products we all rely upon to power the economy and enable our domestic life." The company said in a statement that it "welcomes any well-meaning and good faith attempts to address the risks of climate change."

Chevron dismissed the New York lawsuit as "factually and legally meritless" and said it will "do nothing to address the serious issue of climate change."

Conoco and BP declined to comment.

The National Association of Manufacturers, which represents the oil companies, slammed New York for joining a "politically-motivated campaign to undermine manufacturing in America." The trade group said de Blasio has decided to "play politics with underfunded pension plans" even as New Yorkers have depended on natural gas and oil during the extremely cold weather.

The New York lawsuit follows recent ones filed by San Francisco, Oakland and other California cities and counties. Earlier this week, Exxon launched a counterassault, claiming that California municipalities failed to disclose to municipal bond investors the imminent threat from climate change that they detailed in their oil lawsuits. Exxon said it's the victim of a vast "conspiracy" and "abuse of government power."

Climate activists, who argued the Exxon move amounted to an effort to intimidate local governments, cheered New York's lawsuit.

"New York City today becomes a capital of the fight against climate change on this planet," said Bill McKibben, co-founder of environmental group 350.org, in a statement.

Greenpeace USA Executive Director Annie Leonard said, "New York City's impressive leadership makes me hopeful for the future."

Related: Exxon gives up major climate change fight

New York City's pension system is the fourth largest in the U.S., and controls around $5 billion in the securities of more than 190 fossil fuel companies. The funds invest the pensions of hundreds of thousands of active and retired city teachers, firefighters, police officers and other employees.

"Our announcement sends a message to the world that a brighter economy rests on being green," said New York City Comptroller Scott Stringer.

Stringer acknowledged that divesting from fossil fuels will be "complex" and will "take time." City officials plan to submit a joint resolution instructing pension fund trustees to begin analyzing how it can be done in a responsible way.

The American Petroleum Institute, the powerful oil lobby, accused New York of "deliberately hurting pension holders" by ignoring its legal responsibility of seeking the greatest return. The API called it a "disgraceful way to score cheap political points."

Various other U.S. cities have committed to divest their fossil fuel holdings. Powerful pension funds such as the California Public Employees' Retirement System (CalPERS) have also done so. Even Norway's $1 trillion sovereign wealth fund, built on the country's oil riches, has backed away from fossil fuels.