BRIDGEWATER — The Al Falah Center has agreed not to build a mosque on Mountaintop Road — and will instead build one on a $2.75 million 15-acre lot the township will buy for it under the terms of a settlement, MyCentralJersey.com reports.

The township's insurance carrier will also pay the center $5 million for alleged damages, costs and attorney fees to end the years-long lawsuit, according to the report. The township will be given the Mountaintop Road property in exchange for the 15-acre site between Routes 202-206 and Route 287 it will purchase for the mosque.

According to the report, the settlement was approved Monday by the township council, ending a federal court fight that has cost the township hundreds of thousands of dollars n legal fees so far.

The township planning board dismissed the mosque proposal in 2011, citing an ordinance that limited houses of worship to major roads. Township officials said they didn't mind the mosque — only its proposed location.

But a decision by U.S. District Judge Michael Shipp last year, overruling the application of the ordinance, said after the center applied to build a mosque at the former Redwood Inn site, the project faced "anti-Muslim prejudice within the community, including Internet postings and e-mail correspondence." In one instance, center members were accused of being terrorists, the decision states.

Municipal officials argued that the purpose of the ordinance was to “preserve the residential character of its various neighborhoods,” last year's decision states. But the judge found the township had "rendered it nearly impossible for Al Falah and its individual members to adhere to the tenets of their religion." The judge sent the matter back to the planning board for further review, which has continued up until the settlement.

Louis C. Hochman may be reached at lhochman@njadvancemedia.com. Follow him on Twitter @LouisCHochman. Find NJ.com on Facebook.