NEWARK, N.J. -- An upscale New Jersey town violated anti-discrimination laws by insisting that a proposed mosque have more parking spaces than churches or synagogues because of its unique worship times and traditions, a federal judge has ruled.

The ruling issued Saturday by U.S. District Judge Michael Shipp stated that Bernards Township violated the Religious Land Use and Institutional Persons Act by applying a different standard to Muslims.

CBS New York reported in November that the suit alleged the township violated the Religious Land Use and Institutionalized Persons Act of 2000 when it denied zoning approval to allow the Islamic Society of Basking Ridge to build the mosque.

Get Breaking News Delivered to Your Inbox

Shipp found the township’s planning board had “unbridled and unconstitutional discretion” because of its vague parking requirements.

The Islamic Society’s application to build the mosque was denied after more than three years and 39 public hearings. The group sued the township in March.

The Islamic Society’s attorney, Adeel Mangi, had argued that parking requirements were the tool municipalities used to thwart construction of mosques.

“This truly is a landmark ruling with national impact,” Mangi told NJ.com.

Bernards Mayor Carol Bianchi issued a statement criticizing the judge’s ruling. The town had argued that it was completely appropriate to insist a mosque provide more off-street parking than a comparably sized church or synagogue because of its unique worship times and traditions.

“The Township vehemently disagrees with the court’s decision and awaits a full analysis of the 57-page decision by its attorneys, who only learned of the decision on New Year’s Day,” the statement said. “The Township will consider how to best move forward including appealing the decision when ripe for appeal.”

The mosque has said its peak worship time was likely Friday afternoon prayers. Township planners determined that because congregants would most likely be arriving straight from work, every worshipper would require a parking space.

Shipp, though, noted that the township had not conducted individual assessments of worship habits when churches or synagogues came before its boards. By its own admission, the town applied a different standard to Muslims, he wrote.

Shipp did not take into account the sentiments expressed in emails from township officials that were revealed in documents filed in the case, Mangi noted. In those, officials disparaged the Islamic Society’s president, former mayor Mohammed Ali Chaudry, and passed around jokes calling President Barack Obama a Muslim.