The US cities of San Francisco and Oakland are suing five of the world’s largest oil companies for the coasts of walls and other defences against rising sea levels, saying the industry made vast profits from fossil fuels while knowing they were causing “an existential threat to humankind”.

Drawing a direct comparison to the tobacco industry’s sale of cigarettes despite knowledge of the health risks, the city attorneys announced they had filed separate lawsuits against BP, Royal Dutch Shell, Exxon Mobil, Chevron and ConocoPhillips.

The total amount of money needed was “not known at this time but is expected to be in the billions of dollars”, the lawyers said. The lawsuit for San Francisco and the one filed by Oakland both ask the court to set up an “abatement fund” to pay for infrastructure “necessary for the People to adapt to global warming impacts such as sea-level rise”.

Chevron said the lawsuit would not help the fight against climate change and would “only serve special interests at the expense of broader policy”.

Dennis Herrera, San Francisco’s city attorney, said the companies had “profited handsomely for decades while knowing they were putting the fate of our cities at risk”.

“Instead of owning up to it, they copied a page from the Big Tobacco playbook,” he said.

“They launched a multimillion-dollar disinformation campaign to deny and discredit what was clear even to their own scientists: global warming is real, and their product is a huge part of the problem.

“Now, the bill has come due. It’s time for these companies to take responsibility for the harms they have caused and are continuing to cause.”

Barbara Parker, city attorney for Oakland, spelt out how serious the problem was and argued there was a clear legal case for compensation.

“Global warming is an existential threat to humankind, to our ecosystems and to the wondrous, myriad species that inhabit our planet,” she said.

“These companies knew fossil-fuel-driven climate change was real, they knew it was caused by their products and they lied to cover up that knowledge to protect their astronomical profits.

“The harm to our cities has commenced and will only get worse. The law is clear that the defendants are responsible for the consequences of their reckless and disastrous actions.”

A statement about the cases on the San Francisco city attorney’s website claimed that the five oil firms “have known for decades that fossil-fuel-driven global warming and accelerated sea level rise posed a catastrophic risk to human beings and to public and private property, especially in coastal cities like San Francisco and Oakland”.

“Despite that knowledge, the defendant companies continued to aggressively produce, market and sell vast quantities of fossil fuels for a global market, while at the same time engaging in an organised campaign to deceive consumers about the dangers of massive fossil-fuel production,” the statement alleged.

“The fossil-fuel industry’s own records show that the defendant companies have knowingly misled the American public and the world about the dangers of fossil-fuel driven climate change.

10 photographs to show to anyone who doesn't believe in climate change Show all 10 1 /10 10 photographs to show to anyone who doesn't believe in climate change 10 photographs to show to anyone who doesn't believe in climate change A group of emperor penguins face a crack in the sea ice, near McMurdo Station, Antarctica Kira Morris 10 photographs to show to anyone who doesn't believe in climate change Floods destroyed eight bridges and ruined crops such as wheat, maize and peas in the Karimabad valley in northern Pakistan, a mountainous region with many glaciers. In many parts of the world, glaciers have been in retreat, creating dangerously large lakes that can cause devastating flooding when the banks break. Climate change can also increase rainfall in some areas, while bringing drought to others. Hira Ali 10 photographs to show to anyone who doesn't believe in climate change Smoke – filled with the carbon that is driving climate change – drifts across a field in Colombia. Sandra Rondon 10 photographs to show to anyone who doesn't believe in climate change Amid a flood in Islampur, Jamalpur, Bangladesh, a woman on a raft searches for somewhere dry to take shelter. Bangladesh is one of the most vulnerable places in the world to sea level rise, which is expected to make tens of millions of people homeless by 2050. Probal Rashid 10 photographs to show to anyone who doesn't believe in climate change Sindh province in Pakistan has experienced a grim mix of two consequences of climate change. “Because of climate change either we have floods or not enough water to irrigate our crop and feed our animals,” says the photographer. “Picture clearly indicates that the extreme drought makes wide cracks in clay. Crops are very difficult to grow.” Rizwan Dharejo 10 photographs to show to anyone who doesn't believe in climate change Hanna Petursdottir examines a cave inside the Svinafellsjokull glacier in Iceland, which she said had been growing rapidly. Since 2000, the size of glaciers on Iceland has reduced by 12 per cent. Tom Schifanella 10 photographs to show to anyone who doesn't believe in climate change A river once flowed along the depression in the dry earth of this part of Bangladesh, but it has disappeared amid rising temperatures. Abrar Hossain 10 photographs to show to anyone who doesn't believe in climate change A shepherd moves his herd as he looks for green pasture near the village of Sirohi in Rajasthan, northern India. The region has been badly affected by heatwaves and drought, making local people nervous about further predicted increases in temperature. Riddhima Singh Bhati 10 photographs to show to anyone who doesn't believe in climate change A factory in China is shrouded by a haze of air pollution. The World Health Organisation has warned such pollution, much of which is from the fossil fuels that cause climate change, is a “public health emergency”. Leung Ka Wa 10 photographs to show to anyone who doesn't believe in climate change Water levels in reservoirs, like this one in Gers, France, have been getting perilously low in areas across the world affected by drought, forcing authorities to introduce water restrictions. Mahtuf Ikhsan

“For example, in 1968, a scientific consultant working for the American Petroleum Institute [API], a trade association representing fossil-fuel companies, warned that carbon dioxide emissions were ‘almost certain’ to produce significant temperature increases and a rise in sea levels.

“In 1980, API and its member companies learned that ‘likely impacts’ of global warming would include ‘globally catastrophic effects’.”

The statement said the “defendants’ contributions to global warming” had already caused sea levels to rise in San Francisco Bay, which “threatened imminent harm to San Francisco and Oakland from storm surges”.

“Sea levels will continue rising in the Bay due to defendants’ past, present and ongoing conduct, and this ongoing conduct exacerbates a problem that is largely irreversible.

“A recent state report, Rising Seas in California, projects as much as 10ft of additional sea-level rise along San Francisco’s coastline by 2100, which would be catastrophic.

“In Oakland and San Francisco, property worth billions of dollars is located six feet or less above current sea levels. In San Francisco, bayside sea level rise from global warming places at risk at least $10bn of public property and as much as $39bn of private property.”

San Francisco has developed plans to protect infrastructure from sea level rise that will cost $350m (£258m).

“Climate-change models show large parts of San Francisco and Oakland, including the Oakland airport, under water within 100 years during storm surges,” the statement said.

“The lawsuits ask the courts to hold the defendants jointly and severally liable for creating, contributing to and/or maintaining a public nuisance, and to create an abatement fund for each city to be paid for by defendants to fund infrastructure projects necessary for San Francisco and Oakland to adapt to global warming and sea level rise.

“The total amount needed for the abatement funds is not known at this time but is expected to be in the billions of dollars.”

Shell said in a statement: “The Shell Group has long recognised the climate challenge and the role of energy in enabling a decent quality of life.

“We strongly support the agreement in Paris to limit global warming to 2C or less, but we believe 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.”

A spokesperson for BP said: “We don’t have any immediate comment on it, sorry.”

A spokesman for Chevron, Melissa Ritchie, told the Los Angeles Times that legal action would not help the fight against climate change.

“Reducing greenhouse gas emissions is a global issue that requires global engagement and action,” she said.

“Should this litigation proceed, it will only serve special interests at the expense of broader policy, regulatory, and economic priorities.”