A New Jersey town will pay an Islamic group $3.25million to settle a lawsuit over its denial of a permit to build a mosque, the Department of Justice announced Tuesday.

Under the settlement, the Islamic Society of Basking Ridge will be allowed to build the mosque and Bernards Township — an upscale town in central New Jersey — agreed to limit the zoning restrictions placed on houses of worship.

Of the settlement money, $1.75million will go towards attorneys' fees and costs and the remaining $1.5million is for damages.

In 2016, the Islamic group sued the township, claiming it changed its zoning ordinances in order to deny the group's plans to build a mosque.

The Justice Department also sued the town that year, alleging it treated the group differently than other religious groups.

The US Justice Department announced that Bernards Township, New Jersey will pay Islamic Society of Basking Ridge $3.25million to settle a lawsuit over the town's denial of a permit to build a mosque. Muslim worshippers (pictured in September 2016) have been praying at the Bernards Township Community Center in Basking Ridge, New Jersey in the meantime

Through a spokesman, the township committee denied discriminating against the Islamic Society and maintained the denial of the group's proposal was 'based on accepted land use criteria only'.

The committee noted that the Islamic Society's members have used other township facilities to practice their religion for years.

'We remain a united township where all are welcome,' spokesman Michael P. Turner wrote in an email. 'This is the end of a long engagement on the application and opinions may still be varied, but it is in the best interest of the township to conclude the litigation.'

Central to Bernards Township's concerns was parking.

Township planners had concluded that because Friday afternoon was considered peak worship time, congregants would most likely be arriving straight from work and would each need a parking space.

Bernards Township said they denied the mosque permit in part because they were concerned there wouldn't be enough parking on site for worshippers on Friday afternoons

In addition to the cash payout, the settlement will allow the Islamic group to build the mosque in town, so people, like Shahul Feroze (seen in September 2016), can worship locally

But a federal judge disagreed, and wrote in December 31 ruling that the town hadn't conducted similar assessments of worship habits when churches or synagogues had made applications.

The Justice Department lawsuit also alleged the town changed its zoning laws to require houses of worship in residential districts to be at least 6 acres — larger than the lot the Islamic Society had purchased in 2011.

Eight of 11 other houses of worship built before the zoning laws were changed are on lots smaller than 6 acres, the complaint alleged.

A similar lawsuit cost nearby Bridgewater Township almost $7.75million in a 2014 settlement.

Earlier this month, on May 25, a Muslim group sued the city of Bayonne, New Jersey claiming its proposal to convert an abandoned warehouse into a mosque and community center was unfairly voted down amid a climate of hostility and religious intolerance.