LONDON — The chances of a third runway at Heathrow Airport being built were dealt a major blow on Thursday after a British court ruled that the government had acted illegally by not taking into account its own climate commitments.

Environmental campaigners lauded the landmark ruling from the Court of Appeal, saying it had implications far beyond the multibillion-dollar plan to expand Europe’s busiest airport. Future infrastructure projects, they argued, could also be held to similar environmental standards.

Heathrow’s expansion has been hotly debated in Britain for decades, with environmentalists pushing against it and businesses arguing for it. On Thursday, longtime opponents of the project, including some lawmakers, jumped onto social media to celebrate.

“We won!” tweeted London Mayor Sadiq Khan, who brought the legal action along with environmental groups and London councils. He continued: “Today’s judgment is a major victory for all Londoners who are passionate about tackling the climate emergency and cleaning up our air.”

Zac Goldsmith, the government’s environment minister who once resigned over his opposition to the expansion, tweeted: “HUGE!!!”

Prime Minister Boris Johnson’s administration said it wouldn’t appeal the ruling, but it could, in theory, return with a new proposal for the expansion that does address climate targets.

Heathrow executives said they would challenge the decision. In a statement, the airport said, “Heathrow has taken a lead in getting the UK aviation sector to commit to a plan to get to Net Zero emissions by 2050, in line with the Paris Accord.” It added that expanding Heathrow was “essential to achieving the Prime Minister’s vision of Global Britain. We will get it done the right way, without jeopardising the planet’s future.”

In its ruling, the Court of Appeal said the government hadn’t considered its climate commitments, which are legally binding and informed by the Paris agreement, when it approved the expansion.

Britain is hosting a major United Nations climate change conference later this year, and the country will be keen to brandish its green credentials before world leaders descend on Glasgow in November.

Johnson, for his part, is a longtime opponent of a third runway. As mayor of London, he said that he would lie down in front of bulldozers if that’s what it took to prevent construction.

But the British Parliament gave it a thumbs-up in 2018, voting overwhelmingly in favor of the third runway. Johnson, who was foreign secretary at the time, missed the vote — some say conveniently — because he was on a trip to Afghanistan.

Thursday’s ruling didn’t make a substantive judgment on whether expansion was good or bad.

As one of her last acts as prime minister, Theresa May passed legislation that committed Britain to becoming carbon-neutral by 2050 — one of the goals of the 2016 Paris agreement. Britain was the first major economy to make such a pledge.

Standing outside the courthouse on Thursday in the rain, Green Party candidate Zack Polanski said that those who had campaigned tirelessly for years to block expansion plans were jubilant but aware that there “is still much work to do.”

“The argument has to be loud and clear that we’re living in a climate emergency, and it must be no to all airport expansions,” Polanski said, adding that other governments around the world could learn from the ruling. “If you sign the Paris agreement, it has to mean something.”

Experts said the courts were effectively saying that, like it or not, domestic climate laws are real and need to be factored into policy decisions.

“The government lawyers said that they didn’t need to take into account the Paris agreement, and judges today said, ‘Oh, yes you do,’ ” said Doug Parr, chief scientist at Greenpeace UK. He added that this “opens new legal territory” and that “future decisions will need to take into account the Paris agreement targets, or they will be potentially judicable.”

Parr said the Heathrow decision was particularly thorny because “aviation has struggled with alternatives to fossil fuels, and there isn’t really an answer they could have pulled like a rabbit out of a hat.”

The ruling comes amid a growing number of climate litigation cases in which courts are asked to rule on domestic climate targets.

“There’s a clear trend that shows courts are looking at climate obligations not just as wishful thinking but as serious commitments,” said Robert Falkner, a climate expert at the London School of Economics. He said that Thursday’s ruling could point the way to how “jurisdiction will evolve” in the area.

Greta Thunberg, the teenage climate activist, tweeted on Thursday: “Imagine when we all start taking the Paris agreement into account.”

Friends of the Earth, one of the claimants in the case, said the ruling was a “groundbreaking result for climate justice and for future generations.”