The Trump administration’s plan to drill off the Atlantic Coast for the first time in more than half a century is on the brink of collapse because of a court development Thursday that blocked the first steps to offshore oil and gas exploration, as well as the president’s recent actions that undermine his own proposal.

Opponents of the drilling declared victory on Thursday after the government acknowledged that permits to allow seismic blasting in the ocean — the first step toward locating oil deposits for drilling — will expire next month and not be renewed.

Nine state attorneys general and several conservation groups filed a federal lawsuit early last year to block seismic blasting, arguing it could harm endangered whales and other marine animals. The court battle dragged out so slowly that, in the meantime, time ran out on the permits.

Donna Wieting, director of the National Marine Fisheries Service, a division of the National Oceanic and Atmospheric Administration, said in a court declaration, released Tuesday, that her agency “has no authority to extend the terms of those [permits] upon their expiration. Further, NMFS has no basis for reissuing or renewing these [permits].” The five companies that were granted permits would have to restart the months-long process leading to approval or denial, Wieting said.

Also on Thursday, U.S. District Judge Richard Gergel of South Carolina held a telephone conference with all parties of the lawsuit to determine how to move forward. The judge is expected to declare the case moot because the seismic mapping cannot occur without the permits, said Michael Jasny, who was on the call and is director of the Marine Mammal Protection Project at the Natural Resources Defense Council.

The attorneys and conservationists are focused on protecting the North Atlantic right whale, which is “one step from extinction,” the International Union for Conservation of Nature determined in July. Only about 250 adults remain, including 100 breeding females after collisions with ships, entanglements in fishing nets and underwater noise pollution, according to an assessment by the group.

“It’s most definitely a win. There’s no question,” Jasny said. “Given the broad bipartisan opposition that the threat of seismic blasting and drilling has stirred in communities up and down the coast, it should be the nail in the coffin for oil and gas exploration on the coast.”

The American Petroleum Institute saw the issue differently. “In the long-run, the world is going to demand more energy, not less, and our industry’s priority is ensuring that demand is met by energy produced here in the United States,” said Andy Radford, a senior policy adviser for API, the largest oil and gas lobbying group in Washington.

In 2018, the Trump administration rolled out an ambitious plan to allow drilling along nearly the entire Atlantic Coast. But the proposal collided this year with election politics, as President Trump turned against his own plan in an effort to bolster support from coastal Republicans worried that drilling could result in a spill that would hurt economies that rely on pristine beaches and tourism.

Democrats and Republicans from South Carolina ripped Trump’s decision to offer drilling leases. At a testy hearing last spring in the House, Rep. Joe Cunningham (D-S.C.), engaged in a heated exchange with a Trump administration official over whether seismic testing could harm whales.

“It’s fair to say seismic air gun blasting is extremely loud and disruptive … is that correct?” the congressman asked.

“I don’t know exactly how loud it is. I actually never experienced it myself,” the official replied.

Cunningham lifted a 120-decibel horn and blasted it at the official, filling the small committee room with an eardrum-splitting noise.

On Sept. 8, Trump flew to Florida, an important swing state where his proposal to drill is widely opposed by voters, and signed an executive order to extend a moratorium on drilling in the eastern Gulf of Mexico, as well as expand the ban up the Atlantic to South Carolina. Trump also hinted at banning oil exploration in other Eastern Seaboard states. Governors from Massachusetts to Florida are opposed to offshore drilling.

“This protects your beautiful Gulf and your beautiful ocean, and it will for a long time to come,” Trump said in Jupiter, Fla., last month, calling himself a “great environmentalist.”

The executive order was a stark reversal for the president, whose administration once pushed to open the entire Atlantic, Pacific and Gulf of Mexico to drilling as part of his quest for “American Energy Dominance,” despite the devastating 2010 Deepwater Horizon spill that ruined beaches and fishing from Louisiana to Florida.

When then-Interior Secretary Ryan Zinke announced the drilling plan two years ago, Trump was reportedly angered when Zinke flew to Florida to assure its governor that the state would be exempted.

The stakes are different now. North Carolina, Georgia and Florida — states Trump won in 2016 — are hotly contested by Joe Biden, the Democratic presidential nominee. Biden has vowed to ban any new offshore oil leasing in an effort to fight climate change. Polls show a tight race between the two in all three states.

A drilling ban might also lift the election hopes of two Trump allies — GOP Sens. Lindsey O. Graham (S.C.) and Thom Tillis (N.C.) — and increase the chances of Republicans retaining control of the Senate. Both praised Trump for expanding the ban to the coast off their states.

In a court filing last week, another federal agency, the Bureau of Ocean Energy Management, said it would still consider issuing its own permits to let boats with compressed-air guns out onto the water. The bureau has had nearly a year to approve the permits and has not. Companies would still need the NOAA permits to move forward with exploration.

“It’s a huge victory,” said Catherine Wannamaker, a senior attorney at the Southern Environmental Law Center, a nonprofit law firm representing seismic testing opponents in the case.

“Communities can breathe a little easier knowing the Atlantic is now safe from seismic airgun blasting in 2020,” said Diane Hoskins, campaign director for the ocean environmental group Oceana. “The expiration of these … permits will finally protect coastal communities and our marine life. We are going to do everything in our power to permanently protect our coasts and ensure dynamite-like blasting never starts.”

Correction: An earlier version of this story said that Donna Wieting spoke Thursday. Her statement was made in a court declaration released Tuesday. This report has been updated.