MADISON, Wisconsin — A federal judge in Wisconsin has struck down as unconstitutional a law that gives clergy tax-free housing allowances, in a ruling that could have far-reaching ramifications for religious leaders, who could be facing new taxes which will threaten their ministry.

Under the federal law passed in 1954, a “minister of the gospel” doesn’t pay income taxes on compensation that is designated part of a housing allowance. The Freedom From Religion Foundation, based in Madison, argued that the law discriminates against secular employees.

The benefit saves clergy, including non-Christian religious leaders, $800 million a year in taxes, according to the latest estimate from the congressional Joint Committee on Taxation.

Under the law, housing allowances paid as part of clergy salary can be subtracted from their taxable income.

“This tax provision ensures that faith leaders like South Side, Chicago-based pastor Chris Butler receive the same tax treatment as other employees who must live in the communities they serve—like military service members, teachers, and overseas workers,” Becket – a non-profit religious liberty law firm – said in a press released.

Butler’s Chicago Embassy Church ministers in one of the poorest areas of the city, and Becket said losing the allowance could force Butler to move out of his neighborhood or take up a second job. The firm said it would also force other churches to close altogether.

The Freedom From Religion Foundation argued that a clergy member can use the untaxed income to purchase a home, and then, in a practice known as “double dipping,” deduct interest paid on the mortgage and property taxes.

U.S. District Judge Barbara Crabb ruled Friday that the exemption provides an unconstitutional benefit to religious persons and no one else, violating the establishment clause of the U.S. Constitution.

“In reaching this conclusion, I do not mean to imply that any particular minister is undeserving of the exemption or does not have a financial need for one,” Crabb wrote. “The important point is that many equally deserving secular employees (as well as other kinds of religious employees) could benefit from the exemption as well, but they must satisfy much more demanding requirements despite the lack of justification for the difference in treatment.”

In a brief submitted in support of the housing allowance, Becket stated, “Since its inception, the federal income tax system has recognized that some housing costs are incurred primarily for ‘the convenience of the employer’ — not for the employee’s personal consumption — and are therefore not income. Many tax provisions embody this doctrine.”

The brief acknowledges that some provisions demand case-by-case analysis of each situation, but others establish bright lines for certain classes of workers, reducing the disputes and non-uniformity that would result from a case-by-case approach.

“This reduction of disputes and non-uniformity is especially vital in the context of ministers, because it fulfills the Establishment Clause’s core directives of limiting entanglement between church and state and avoiding discrimination among religious groups,” the brief reads.

“It’s not unconstitutional for the federal government to treat faith leaders the same as other secular employees in their housing allowances. In fact, treating them differently would be discrimination against religion, pure and simple,” said Hannah Smith, senior counsel at Becket, in a statement.

Crabb also struck down the law in 2013, but the 7th U.S. Circuit Court of Appeals reversed the ruling, saying the co-presidents of the anti-religion group who challenged it didn’t have standing to bring the lawsuit because they had never been denied the parsonage exemption.

So in 2015, Freedom From Religion’s co-presidents requested the tax benefit and were rejected by the IRS, leading them to file a new lawsuit last year.

U.S. Department of Justice spokeswoman Lauren Ehrsam declined to comment Monday. The Justice Department was defending Treasury Department Secretary Steve Mnuchin and Internal Revenue Service Commissioner John Koskinen, who were named in the lawsuit.

Annie Laurie Gaylor, co-president of the Freedom From Religion Foundation, heralded the victory and said she was confident it would survive challenges on appeal.

“It’s a huge ruling,” Gaylor said. “The last one created shockwaves and this one should really be creating them. … I think everybody knows we’re right, they just don’t like changing the law.”

While Crabb ruled the law unconstitutional, she deferred taking action on granting relief, which could include an injunction to block the granting of the tax benefit. Crabb ordered both sides to make arguments by Oct. 30 on what remedies would be appropriate.

“This decision is crippling to the equal treatment of our nation’s faith leaders—but it will not stand,” Butler said in a statement.

Crux staff contributed to this report.