The state Court of Appeals affirmed a ruling last year that said the state oil and gas law doesn't override the authority of local governments to control land use through zoning.

New York's top court handed a victory to opponents of hydraulic fracturing for natural gas Monday by affirming the right of municipalities to ban the practice within their borders.

The state Court of Appeals affirmed a midlevel appeals court ruling from last year that said the state oil and gas law doesn't trump the authority of local governments to control land use through zoning.

The two "fracking" cases from two central New York towns have been closely watched by drillers hoping to tap into the state's piece of the Marcellus Shale formation and by environmentalists who fear water and air pollution.

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 the bans, 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.

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.

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 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.