Months after being sued, a small Massachusetts town has agreed to let a local Islamic group build a cemetery that some neighbors opposed.

Under a deal approved this week, the town of Dudley will permit the Islamic Society of Greater Worcester to buy a long-idle dairy farm and build a 6-acre cemetery at the site. In exchange, the group won't seek to expand the burial ground for at least a decade and will drop a lawsuit it filed against the town in July.

The society sued Dudley after a town zoning board denied plans for the cemetery in June, saying the group didn't have standing to seek a special permit. The group, which runs a mosque about 20 miles from Dudley, alleged that its constitutional rights were violated in the rejection.

During earlier meetings on the proposal, some residents had said they were worried the cemetery could contaminate groundwater because Muslims traditionally don't embalm bodies and bury their dead without coffins. They also cited concerns about noise, vandalism and increased traffic on the narrow road along the proposed site.

The group's leaders described those arguments as thinly veiled bigotry.

Both sides negotiated until October, when a lawyer for the Islamic group said talks had reached a standstill. But on Thursday, the town's governing body announced it had reached a deal.

Under the agreement, the Islamic group must return to the zoning board in early 2017 for a public hearing, but the cemetery proposal is to be approved. Once all its permits are granted, the group will drop its lawsuit. The deal says that Dudley won't make any settlement payments to the group or its attorneys.

Khalid Sadozai, trustee of the society, said in a statement that the group is going forward with the project.

"Today is a good day for citizens of all beliefs," he said. "Our right to practice our religion and honor loved ones in accordance with our Islamic faith has been affirmed."

The chairman of Dudley's governing body, Jonathan Ruda, issued a statement saying the agreement allows a fair, open application of the law.

"We want to stress that the town's sole interest and motivation has been for all parties to respect the legal and regulatory process, and has absolutely nothing to do with the religious affiliation of the applicant," he said.

Similar disputes have erupted across the country in states such as Texas, Pennsylvania and Minnesota. In some cases, opponents have defeated cemetery projects, while in others, Muslim groups have appealed and judged have cleared the way.