For months , the utility that provides gas to Long Island and parts of New York City refused to activate gas hookups for both new and returning customers, casting some real estate developments into limbo.

The utility’s moratorium triggered a political standoff that intensified this month, when Gov. Andrew M. Cuomo issued a threat: either the company, National Grid, turn the gas on for all its potential customers, or the state would pull its license to operate in southern New York.

The threat apparently worked. On Monday, the governor and National Grid announced an agreement that would restore gas service to customers and applicants the utility had previously rejected.

Under the deal, National Grid will lift its moratorium immediately. It will have 30 days to contact all residential customers and small businesses who seek gas hookups, and 45 days to start the process of restoring service to larger commercial projects, officials said .