(CNN) An Islamic society in New Jersey is allowed to move forward with plans to build a mosque, and the town that had denied it permission will pay $3.25 million, as the result of settlements finalized Tuesday in two federal lawsuits.

The two lawsuits were the latest in a nearly four-year dispute between the Islamic Society of Basking Ridge and Bernards Township, New Jersey, which had denied zoning approval for the Islamic society to build a mosque. It would have been the first and only mosque in the town, and the society bought the proposed mosque site because zoning of the land permitted houses of worship, according to court documents.

In March 2016, the Islamic society sued the town. The Department of Justice filed suit against Bernards Township in November. Monday's settlements resolve both lawsuits, according to court documents.

"Federal law requires towns to treat religious land use applications like any other land use application," acting US Attorney for New Jersey William E. Fitzpatrick said in a statement. "Bernards Township made decisions that treated the Islamic Society of Basking Ridge differently than other houses of worship. The settlement announced today corrects those decisions and ensures that members of this religious community have the same ability to practice their faith as all other religions."

The DOJ's complaint alleged the township denied the application to build a mosque using standards it had not applied to other religious and nonreligious groups in the past.

Read More