LOS ANGELES (Reuters) - An underground natural gas pipeline rupture that caused the largest-ever methane leak in California has been permanently capped, paving the way for thousands of displaced Los Angeles residents to return home, state regulators said on Thursday.

A gas company sign marks a fence near the site of the Aliso Canyon storage field where gas has been leaking in Porter Ranch, California, United States, January 21, 2016. REUTERS/Lucy Nicholson

The leak, which began in October and accounted for a fourth of all daily methane emissions statewide at its height, was confirmed by a series of independent laboratory tests to have been successfully sealed as of Wednesday night, officials said.

The leak originated from a broken injection-well pipe deep beneath the surface of the 3,600-acre (1,457-hectare) Aliso Canyon natural gas storage field, owned by Southern California Gas Co.

State officials said the uncontrolled release of 80,000 tons of methane, the main component of natural gas and a far more potent greenhouse agent than carbon dioxide, ranked as the largest such discharge on record in California.

Environmental groups seized on the breach to call attention to hazards posed by the state’s aging fossil fuel energy infrastructure, and Governor Jerry Brown declared the gas leak a state emergency.

The stench of fumes from the site sickened scores of people for weeks and prompted the temporary relocation of more than 6,600 households from the northern Los Angeles community of Porter Ranch, located at the edge of the gas field.

Jason Marshall, chief deputy director of the California Department of Conservation, said it was safe for residents to return, and that the utility had agreed to continue paying their relocation expenses through next Thursday morning.

The announcement came a day after the utility, a division of San Diego-based Sempra Energy, pleaded not guilty to criminal misdemeanor charges stemming from the leak, which prosecutors said the company failed to report in a timely manner. Local, state and regional authorities, as well as dozens of residents, have also sued SoCal Gas.

In addition to facing possible fines and civil liability, the utility expects pipeline repair costs and housing relocation expenses will end up running about $300 million, said SoCal Gas Chief Executive Officer Dennis Arriola.

The actual leak was apparently stanched late last week. The utility said on Friday that infrared monitoring by state regulators showed a newly drilled relief well had managed to intercept the pipeline breach and halt the gas flow.

A series of follow-up emissions and infrastructure tests confirmed that the cement plug pumped into the crippled injection well pipe was holding, Marshall said.