A federal judge ruled Saturday that a New Jersey town broke the law by requiring more parking spaces for a mosque than for other places of worship.

The planning board of Bernards Township, N.J., denied plans to build a mosque due to concerns that there were not enough parking spaces, arguing that mosques needed more parking than churches or synagogues due to different times of worship.

After nearly four years of hearings, the Islamic Society sued the township in March 2016. U.S. District Judge Michael Shipp declared Saturday that the town’s actions violated the Religious Land Use and Institutional Persons Act.

Parking requirements have been previously used against the building of mosques, and the Islamic Society’s lawyer Adeel Mangi reportedly said, “(t)his truly is a landmark ruling with national impact.”

In court, the township insisted that the issue was not a religious one, but a concern over parking, with the township’s attorney saying in court, “it’s based simply on the parking needs of the applicant.”

Judge Schipp, however, disagreed, and ruled that the parking requirements gave the town board “unbridled and unconstitutional discretion.”

Follow Justin on Twitter