EDITOR'S NOTE: This story contains language some may find offensive.

BAYONNE — A Muslim group will be allowed to move forward with plans to build a mosque after this Hudson County city agreed to settle a religious discrimination lawsuit for $400,000.

The Bayonne Muslims sued the city last year in federal court after the Zoning Board denied an application to build a house of worship in an industrial part of town. The lawsuit said the Muslims were subjected to “explosive hostility” and anti-Muslim bigotry.

Meanwhile, a federal Department of Justice investigation into the city continues.

The Bayonne settlement is just the latest example of fiery opposition to a planned mosque resulting in costly litigation and a settlement that allows the house of worship of proceed anyway.

Last year, Bernards in Somerset County approved construction of a mosque following years of debate and a $3.25 million settlement. The township was sued by both a local Muslim congregation and the federal Justice Department.

In 2014, Bridgewater settled a lawsuit over a rejected Islamic center for $7.5 million.

In all of the cases, usual land-use and planning concerns about parking, flooding and traffic were interspersed with comments about the Islamic religion.

Bayonne Mayor Jimmy Davis said the city settled "to protect our taxpayers." The settlement will be paid out of an insurance fund.

"Everybody deserves a place of worship. Religious freedom is one of America’s founding principles," he said in a statement Thursday. "The Muslims have been part of our community for a long time, and we have always worked together."

The Bayonne Muslims first sought to turn an an ugly former warehouse next to gas tank into a house of worship in 2015.

Houses of worship are conditionally permitted in residential neighborhoods in Bayonne. The lawsuit says the Zoning Board required them to provide for more parking than was required for other houses of worship.

During public meetings and in public, Muslims said they faced harsh pushback.

Their lawsuit said a police officer at a Zoning Board meeting told them to "go back where you're from."

At the Catholic school building where Muslims had been allowed to pray in the basement, someone spray-painted “FUCK MUSLIMS" and "FUCK ALLAH.”

Pamphlets and newspaper advertisements encourages boycotts of businesses believed to be supportive of the Muslim group.

Abdul Hamid Butt, president of Bayonne Muslims, said Wednesday that they were pleased with the outcome.

"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," he said in a statement Wednesday. "We are confident our application, considered on its merits, will be approved and we look forward to welcoming Bayonne residents of all faiths to the City’s first mosque.”

The group's attorneys at Belknap Webb & Tyler said municipalities should expect to "face the full weight of the law" if they "give in to local hatred and treat Muslims unequally."

A spokesman for the city could not immediately be reached for comment.

Sergio Bichao is deputy digital editor at New Jersey 101.5. Send him news tips: Call 609-359-5348 or email sergio.bichao@townsquaremedia.com.