BAYONNE, N.J. (AP)  A New Jersey city has finally given approval to a Muslim group”s bid to build a mosque, ending a saga that started last summer when Bayonne turned down the project and the group sued.

The Bayonne zoning board approved the project on Monday night after the Bayonne Muslims charged in a lawsuit that their two-year effort to convert an abandoned warehouse into a mosque and community center was met by virulent attacks against their religion and was then unfairly voted down by the board.

The group said the attacks included flyers calling for boycotts of Muslim-owned businesses with references to the Sept. 11 attacks and anti-Muslim graffiti on the walls of the church they rented for prayer services. Signs saying “Save Bayonne” and “Stop the mosque” were displayed around the town.

At one zoning board hearing, a group began loudly reciting a Christian prayer while a group of Muslim attendees was praying quietly in a corner, the suit said. One person argued to the zoning board that the mosque should be denied because people would become radicalized and kill people, while another said that the Muslim” beliefs should be carefully examined, according to the suit.

The zoning board in the working-class city across the harbor from New York City voted 4-3 in March 2017 in favor of the mosque proposal, but it needed a minimum of five votes to pass. The settlement announced in January called for Bayonne to pay the group $400,000 and have the project go before the zoning board for another vote.

“We are very pleased to have received a unanimous approval from the Zoning Board and look forward to welcoming Bayonne residents of all faiths to the city”s first mosque,” said Adeel Mangi, a lawyer for the Muslim group, told The Jersey Journal .

Before the board unanimously approved the project Monday, opponents called on them to again reject it.

“I do not believe our city should bend to the threat of a lawsuit,” said Joseph Basile, a local pastor whose house was vandalized with graffiti after hanging signs in his window that read “Save Bayonne” and “Stop the Mosque.”

“You did act in good faith when you denied this application,” he added. “Please do not be bullied by a lawsuit.”

City officials noted that a lengthy legal battle could have cost Bayonne millions of dollars. Federal law enforcement officials also announced an investigation into the city”s decision.

Mosque opponents have cited parking and traffic issues as their main concerns, although the Bayonne Muslims argued that the building would be located in an uncongested part of the city with ample parking.

“This is not fair to me or my neighbors,” city resident Melanie Flora said, saying the mosque”s approval would impact her quality of life because the area would be “subjected to an influx of cars, people and noise coming into the neighborhood seven days a week.

“To my Muslim friends here, I accept everybody for who they are,” she said. “(But) I don”t want to be discriminated against.”