Suffolk County and Southampton Town officials have agreed to reimburse a man for legal fees after he waged a seven-year battle to overturn local restrictions regarding where he and other sex offenders can live.

Federal court records show the case was dismissed Dec. 10 after the county and town agreed to each pay $18,750 — a total of $37,500 — to go toward Duane Moore’s attorney fees.

Moore, 56, of Southampton, sued Suffolk and Southampton in 2009, alleging that local laws dictating where sex offenders can live in relation to schools and playgrounds were so vague and restrictive they amounted to “banishment.”

Moore’s attorneys argued, among other claims, that New York State’s sex offender residency laws superseded the county’s and town’s restrictions.

advertisement | advertise on newsday

They were proved right in February 2015, when the state’s highest court ruled in a separate case that local governments cannot impose their own conditions on where sex offenders reside. The decision effectively invalidated more than 100 local restrictions across the state, including those in Nassau, Suffolk and Southampton.

Michael Diack, a sex offender living in Nassau County, filed the case that led to that ruling, which prompted a federal judge to rule in Moore’s favor in April.

“I can tell you that the people who work with offenders almost uniformly despise these ordinances,” Bruce Barket, Moore’s Garden City-based attorney, said in an interview Wednesday. “They do nothing to protect the public and they make it much more difficult for the offenders to reintegrate into society and live law-abiding lives.”

Southampton Supervisor Jay Schneiderman said he was not sure about the future of the town’s laws.

“The town’s law was stronger than the state’s law, and this is the resolution, basically,” Schneiderman said Thursday. “I think the question remains whether the town will take its law off the books or simply not enforce it. I don’t have an answer to that right now.”