ALBANY, N.Y. — Environmental advocates and backers of natural gas drilling wrangled Thursday over whether New York's towns have the legal right to ban oil and gas development in a fight that could ultimately be decided by the state's highest court.

A four-judge appellate panel heard arguments over the local bans in Dryden and Middlefield, two central New York towns among dozens in the state that have passed zoning laws prohibiting drilling. Opponents argue state rules supersede such local bans.

The Dryden law is being challenged by drilling company Norse Energy, and the Middlefield ban by a dairy farmer who said the town's action prevents her from making money from gas wells that had been planned for her land.

The cases are being closely watched by other towns across the state as a test of their constitutional right of "home rule." They're also of interest to the industry, which has claimed it can't operate profitably in a state with a patchwork of local regulation that may shift with each town board election.

In the past few years, more than 50 New York state municipalities have banned gas drilling, and more than 100 have enacted moratoriums on drilling activities. The bans stem from residents' concerns about potential harm to the environment if the state lifts its moratorium on gas drilling that uses high-volume hydraulic fracturing. The practice, known as fracking, frees gas from deep rock deposits by injecting wells with chemical-laced water at high pressure.

Trial-level state Supreme Court judges have upheld bans in Dryden, Middlefield, and the Livingston County town of Avon.

At the heart of the cases is the interpretation of a state law passed in 1981 that says regulation of the oil and gas industry rests solely with the state Department of Environmental Conservation, which "supersedes" local laws and ordinances.

"Our argument is that the towns of Dryden and Middlefield are not trying to regulate the industry; they recognize that regulating the industry is a matter for the state," said Deborah Goldberg, an attorney for the environmental group Earthjustice. "But the town of Dryden is exercising its constitutionally protected local power to regulate land use through zoning."

Goldberg, representing Dryden, argued the state's highest court, the Court of Appeals, had ruled that a law regulating the mining industry did not pre-empt local zoning rules, including a ban. Tom West, who represents Norse, argued that case doesn't apply because state mining law is fundamentally different from its oil and gas statutes.

West said the oil and gas law is intended to prevent waste of the resource and protect the mineral rights of multiple landowners.