Both sides are still waiting to see whether a statewide moratorium on fracking in effect since July 2008 will be lifted.
The court in a 5-2 decision stressed that it did not consider the merits of fracking, but only the "home rule" authority of municipalities to regulate their land use. The court said the towns of Dryden and Middlefield both acted properly.
"The towns both studied the issue and acted within their home rule powers in determining that gas drilling would permanently alter and adversely affect the deliberately-cultivated, small-town character of their communities," according to the majority ruling by Judge Victoria Graffeo.
Fracking frees gas from deep rock deposits by injecting wells with chemical-laced water at high pressure. It has helped boost U.S. oil and gas production to the highest level in more than a quarter-century, but has mobilized environmentalists alarmed at its rise.
Drilling opponents say more than 170 towns have passed bans or moratoriums. Another 40 towns have passed resolutions supporting gas development.
The state has its own 6-year-old moratorium on fracking for gas. Gov. Andrew Cuomo has said he won't decide whether to lift the ban until a health impact review launched in 2012 is completed. There's no timetable for the review.
The group New Yorkers Against Fracking renewed its call on Cuomo to enact a permanent statewide ban in light of the high court decision, saying "water and air contamination don't stop at local boundaries."
The Dryden ban was challenged by a trustee for Norse Energy, an Oslo, Norway-based company that went bankrupt after amassing thousands of leases on New York land it was never able to develop. The Middlefield ban was challenged by Cooperstown Holstein, a dairy farm that had leased land for drilling.
Karen Moreau of the state Petroleum Council said the ruling threatens the rights of landowners who want to lease their property for development and reduces the chances of long-term investment in the region, given the turnover in local boards.
"There are real losses here, and it's a real tragedy for thousands of impoverished farmers and rural people," she said.
In his dissent, Judge Eugene Pigott Jr. argued that the local ordinances, which touch on areas like storage and productions materials, are so broadly written they create "a blanket ban" on the industry.
"The zoning ordinances of Dryden and Middlefield do more than just regulate land use, they regulate oil, gas and solution mining industries under the zoning," he wrote.