/ Updated 
By Chris Fuchs

A $400,000 settlement has been reached in a federal lawsuit filed by a Muslim congregation that accused a New Jersey zoning board of discrimination when it turned down their bid to open a mosque.

The agreement, filed on Wednesday in District Court in New Jersey, said that the City of Bayonne will pay Bayonne Muslims $120,000 in damages and $280,000 in attorneys fees. It also allows their mosque application, voted down in March, to move forward.

A rendering of the exterior of the proposed mosque in Bayonne, New Jersey, taken from court documents.

“We are so grateful for the support of so many of our fellow Bayonne residents through this long struggle and we commend the City of Bayonne for moving now to correct the wrong that was done to Bayonne’s Muslims,” Abdul Hamid Butt, president of the congregation, said in a statement.

The settlement calls for the zoning board to hold a special meeting on the application and its agreement to settle. The board must adopt a resolution on its decision whether to grant approval no later than 15 days after that meeting.

The agreement would be void if the board doesn’t entirely green light the bid or doesn’t adopt a resolution, court documents said.

Bayonne Muslims in its application has agreed, among other things, to add a second or third Friday service if it exceeds capacity and not to use the facility for unrelated purposes during prayer services, according to the settlement.

Bayonne Mayor Jimmy Davis in a statement said the city settled the suit to protect its taxpayers, adding that money for the payment will come from a joint insurance fund to which it belongs.

“The Muslims have been part of our community for a long time, and we have always worked together,” Davis said.

“Everybody deserves a place of worship,” he continued. “Religious freedom is one of America’s founding principles.”

It wasn’t immediately clear how the settlement will affect a Justice Department investigation into the zoning board’s decision, launched shortly after the group sued.

A Justice Department spokesperson did not respond to an email requesting comment Thursday morning.

Bayonne Muslims filed its suit in May, alleging that despite four out of seven zoning board members voting to approve its application, the body ultimately barred the group from converting a former factory and warehouse it had purchased for around $1 million into a mosque.

Three public hearings between January 2016 and March 2017 attracted large crowds of Bayonne residents, many of them opposed to the plan, the lawsuit contended. The rhetoric at times turned heated, though some spoke in defense of the group.

Bayonne Muslims claimed its application was treated more harshly than those filed by Christian churches in meeting zoning requirements for houses of worship in residential areas, court papers said.

It also accused the zoning board of insisting that Bayonne Muslims provide far more parking for its proposed mosque than what is required under law, according to the lawsuit.

The allegations raised in court papers by Bayonne Muslims came just days after a New Jersey township voted to settle two federal lawsuits alleging it discriminated against the Islamic Society of Basking Ridge when it rejected its application to build a mosque.

The law firm representing Bayonne Muslims, Patterson Belknap Webb & Tyler, also represented the Islamic Society of Basking Ridge.

In that case, Bernards Township agreed to pay $1.5 million in damages to the Islamic society and $1.75 million in attorneys’ fees and litigation expenses.

Court papers said the group will also be permitted to construct its mosque on the roughly 4-acre property it bought in 2011.

Patterson Belknap Webb & Tyler announced in January that it had donated its attorneys fees from the Islamic Society of Basking Ridge lawsuit to a variety of charities. It also said the money was used, among other things, to create scholarships for Muslim-American law students.

Follow NBC Asian America on Facebook, Twitter, Instagram and Tumblr.