Young hogs at a farm in Farmville, N.C., in July 2017. (AP) (Gerry Broome/AP)

The world’s largest pork producer is teaming up with a Virginia-based energy company to harness methane gas from thousands of malodorous hog lagoons to both heat homes and combat climate change.

Food giant Smithfield Foods and Dominion Energy, a large electric and gas utility, have agreed to spend $125 million each over 10 years to cover hog lagoons in North Carolina, Virginia and Utah, capture methane gas and feed that into Dominion’s pipeline network, the companies said.

The joint venture, which would be one of the largest animal waste-to-energy efforts of its kind, would be a step forward in containing U.S. agricultural emissions, which account for 9 percent of the nation’s greenhouse gas emissions. The states were chosen because both companies have operations there.

“The environmental footprint of agriculture has to do with the crops fed to livestock but also the waste part of animal agriculture,” Ken Sullivan, Smithfield chief executive, said in an interview. “This effort is focused on the waste aspect in our endeavor to divert an inevitable part of the waste stream into something usable, that has economic benefit and, in the process, reduces our carbon footprint.” He said farmers would benefit, too.

Methane also plays a key role in climate change. The gas is 25 times as potent a greenhouse gas as carbon dioxide, though it breaks down in a much shorter time frame of 10 to 20 years.

Smithfield has said it aims to introduce manure-to-energy projects covering 90 percent of the company’s hog finishing spaces in North Carolina and Utah. Finishing spaces, where hogs spend about 20 weeks growing from 50 pounds to market weight, are the biggest farms. But the initial stage of the project will involve four clusters of 20 to 25 farms each.

The Environmental Protection Agency says that U.S. greenhouse gas emissions from agriculture have grown by approximately 17 percent since 1990. The driver behind that increase has been the 68 percent rise in emissions from livestock manure. Emissions from other agricultural sources have either remained flat or changed little since 1990.

Smithfield’s hog-rearing operations — including both company and individual farmer owned — produce enough manure to account for 35 to 40 percent of the company’s carbon footprint.

Sullivan vowed in late 2016 to reduce Smithfield’s greenhouse gas emissions by 25 percent from 2010 levels by 2025. Though he wouldn’t disclose where the company stands now, he said Smithfield would spend hundreds of millions more in the effort.

“It’s a heavy lift to get there,” he said. “There’s a fair amount left to do.”

The company tried to capture methane about 13 years ago, efforts that were “pretty spectacular failures,” Sullivan said. The company lost about $25 million to $30 million, he said. The company used digesters to convert the gas from manure to biodiesel. But the effort failed because new feed for the animals reduced the amount of energy in the manure and problems plagued some of the equipment.

This time, Smithfield hopes a different plan and assistance from Dominion will help iron out issues. The captured methane will be taken by pipeline or truck to Dominion facilities that remove water, carbon dioxide and other gases so that the methane that remains can be fed into pipelines. That would crowd out other gas sources that are not renewable.

Smithfield will capture the gas by covering the lagoons with high-density plastic and digesters, equipment used to extract the key elements. This will, incidentally, keep some rainwater off in the event of a heavy downpour, like the rain that fell during Hurricane Florence, flooding the lagoons and spilling waste.

The model for the waste-to-energy project is OptimaBio’s three-farm project in North Carolina that collects biogas streams at a common refinery for injection into a local natural gas pipeline.

When the projects are fully scaled up, they have the potential to capture more than 85,000 metric tons of methane a year, according to the Environmental Defense Fund. The climate impact of these reductions over 20 years would be equivalent to eliminating carbon dioxide emissions from more than 700,000 homes, EDF said.

Though natural gas prices, fed by shale drilling, have been low for years, Smithfield hopes to take advantage of better prices available in markets driven by regulations designed to boost renewable energy. Those include the renewable fuel standard and state mandates requiring utility companies to meet certain targets for renewable energy use.

Dominion’s chief executive, Tom Farrell, said the company wants to reduce its carbon footprint, which, according to him, is half as big as it was 15 years ago in its electric power business. Reducing methane emissions, he said, “is voluntary. There are no regulations that make us do this. No carbon tax or emissions reduction requirements.”

The hog manure is a modest step, though. Farrell said the company hopes to ultimately get 4 percent of its total gas supply from all renewable sources, not just from hog manure alone.

Dominion, which has 65,000 miles of pipelines, is also in talks to capture methane from a food waste and waste water treatment facility in Salt Lake City called the South Davis Sewer District Plant.

Ryan Childress, manager of Dominion Energy Transmission’s midstream operations, said “You’re taking something that without doing this you’re basically seeing that carbon go straight into the atmosphere.”