By Katherine Blunt

The builders of the Atlantic Coast Pipeline are pulling the plug on the project as companies continue to meet mounting environmental opposition to new fossil-fuel conduits.

Duke Energy Corp. and Dominion Energy Inc. said Sunday they were abandoning the proposed $8 billion pipeline -- which aimed to carry natural gas 600 miles through West Virginia, Virginia and North Carolina and underneath the Appalachian Trail -- citing continued regulatory delays and uncertainty, even after a favorable Supreme Court ruling last month.

Dominion said it was selling the rest of its natural-gas transmission and storage network to Warren Buffett's Berkshire Hathaway Inc. for $9.7 billion including debt. The deal includes a 25% stake in the Cove Point liquefied natural gas export facility in Maryland, of which Dominion will remain the largest owner.

"This announcement reflects the increasing legal uncertainty that overhangs large-scale energy and industrial infrastructure development in the United States," Dominion and Duke said in a joint statement. "Until these issues are resolved, the ability to satisfy the country's energy needs will be significantly challenged."

Utilities and pipeline companies have been trying to expand U.S. pipeline networks for more than a decade to take advantage of the bounty of oil and gas unlocked by the fracking boom. But many of the projects have encountered intense opposition from landowners, Native American groups and environmental activists concerned about climate change who want to keep fossil fuels in the ground.

The Keystone XL pipeline expansion to carry oil from Canada to the U.S. Gulf Coast remains unbuilt more than a decade after it was proposed by TC Energy Corp. The operator of the Dakota Access pipeline, Energy Transfer LP, completed the conduit to carry oil from North Dakota's Bakken shale region to Illinois in 2017 after years of protests and delays.

The Trump administration has sought to make it easier for companies to build pipelines and other energy infrastructure, but the effort has failed to fast-track projects amid continued legal and regulatory challenges by opponents.

Dominion and Duke had first proposed building the Atlantic Coast Pipeline in 2014. It repeatedly faced legal challenges from environmentalists, Native American groups and others. Its costs had swelled to $8 billion before the companies decided to abort the plan.

"This is tremendous news for West Virginians, Virginians, and North Carolinians who deserve clean air, safe water and protection from climate change," said Gillian Giannetti, an attorney with the Natural Resources Defense Council. "The costly and unneeded Atlantic Coast pipeline would have threatened waterways and communities across its 600-mile path."

The companies had scored a significant victory last month when the Supreme Court ruled that it could cut under the historic Appalachian Trail, which runs from Georgia to Maine. The court overturned a lower-court ruling that found the U.S. Forest Service didn't have the authority to grant a special-use permit that allowed for the development of that segment.

However, Duke and Dominion said Sunday that the ruling wasn't enough to mitigate an "unacceptable layer of uncertainty and anticipated delays" for the project. They cited a Montana court ruling last month that threw another roadblock in the path of the Keystone XL Pipeline as an example of the continued challenges such projects face.

That ruling, which related to a federal permit program for oil and gas pipelines, had the potential to also further delay the Atlantic Coast Pipeline, the companies said. The companies involved had together invested about $3.4 billion in the pipeline to date.

Duke, based in Charlotte, N.C., provides electric and gas service to more than nine million customers in the Carolinas, the Midwest, Florida and Tennessee.

Dominion, based in Richmond, Va., provides electricity or natural gas to about seven million customers in 20 states. It will almost entirely exit from its gas-transmission business with the sale of its pipeline and storage assets to Berkshire Hathaway Energy.

As part of the deal, Berkshire Hathaway Energy will acquire Dominion Energy Transmission, Questar Pipeline and Carolina Gas Transmission as well as a 50% stake in Iroquois Gas Transmission System.

Berkshire Hathaway Energy will also acquire 25% of Cove Point LNG, one of six liquefied natural gas export facilities in the U.S. Dominion will retain a 50% stake in the project, with Brookfield Asset Management owning the remaining 25%.

Berkshire Hathaway Energy operates a $100 billion portfolio of utility, transmission and generation businesses providing natural gas and electricity to more than 12 million customers. The Dominion acquisition will add 7,700 miles of natural-gas storage and transmission pipelines and about 900 billion cubic feet of gas storage to its holdings.

"Acquiring this portfolio of natural gas assets considerably expands our company's footprint in several Eastern and Western states as well as globally," Bill Fehrman, Berkshire Hathaway Energy's president and chief executive, said in a statement.

The $9.7 billion transaction includes $5.7 billion in debt. It is expected to close in the fourth quarter.

Dominion said the sale will allow it to focus on its state-regulated gas and electric utilities. It expects those businesses, primarily those serving Virginia, Ohio, Utah and the Carolinas will account for as much as 90% of future operating earnings.

Dominion and Duke have each been pushing to slash their carbon emissions in response to state mandates and customer concerns about climate change. Both companies are aiming for net-zero carbon emissions by 2050 by developing more wind and solar power and investing in other clean technologies.

Duke said that it plans to invest in renewable-energy, battery storage and energy efficiency programs as it works to find cleaner ways to generate power.

"While we're disappointed that we're not able to move forward with ACP, we will continue exploring ways to help our customers and communities, particularly in eastern North Carolina where the need is great," Chief Executive Lynn Good said in a statement.

Write to Katherine Blunt at Katherine.Blunt@wsj.com