The Internal Revenue Service has a rule allowing ministers to exclude the amount of a housing allowance from their taxable income.

In December, I wrote about a case in which an atheist group challenged that rule, claiming it’s an unconstitutional establishment of religion.

On March 15, a three-judge panel of the U.S. Court of Appeals for the 7th Circuit disagreed and unanimously upheld the rule.

Since Congress imposed an income tax in 1913, the rules for what constitutes “income” have become increasingly complex.

What about when an employer provides housing or compensates an employee for its cost? In 1923, Congress enacted a statute excluding a church-provided parsonage from a minister’s taxable income and later extended that to housing allowances.

The Freedom From Religion Foundation (FFRF) prepared to challenge this rule by first giving its own co-presidents a housing allowance similar to what a minister might receive.

On their 2012 and 2013 income-tax returns, those individuals claimed refunds based on excluding that allowance from their taxable income. The IRS denied their refund claim because they are not ministers, and they sued.

A U.S. District Court in Wisconsin ruled in favor of FFRF, striking down the IRS rule.

Three 7th Circuit judges—Senior Judge William Bauer, appointed by President Gerald Ford; Senior Judge Daniel Manion, appointed by President Ronald Reagan; and Judge Michael Brennan, appointed by President Donald Trump—reviewed the district court’s decision. Brennan wrote the unanimous opinion.

Few areas of constitutional law are as confused as the Supreme Court’s Establishment Clause cases. The court has used several different tests to determine whether a government action is an establishment of religion, enabling lower courts to pick and choose which one will produce a desired result.

In this case, the district court applied criteria from the Supreme Court’s 1971 decision in Lemon v. Kurtzman, which requires that statutes or regulations have a “secular legislative purpose.” The court said that the “true purpose” of the IRS rule was to “provide aid for a group of religious persons.”

The 7th Circuit disagreed, noting that the IRS rule puts ministers on equal footing with secular employees who receive the very same benefit.

The IRS code has many provisions that cover different subsets of taxpayers. This one involves employees whose housing can be used for the benefit of their employer. That certainly includes ministers.

The court also said that this IRS rule actually avoids excessive government entanglement with religion, another criterion from the Lemon decision. It avoids, for example, intrusive inquiries about the particular activities of a church and its ministers or about which activities happen on which premises.

The court also reviewed the IRS rule under a more recent Supreme Court test. In Greece v. Galloway, the Supreme Court held that the Establishment Clause must be understood in light of “historical practices and understandings.”

Congress, the court acknowledged, “has enacted federal tax exemptions for religious organizations as far back as 1802” and today, “more than 2,600 federal and state tax laws provide religious exemptions.”

This long history, the court said, satisfies the historical significance test.

Just as the 7th Circuit had to use the right criteria or test to evaluate the district court’s decision, we must always use the right standard when evaluating a court decision.

That standard does not include whether we like the result. Courts must decide cases based on an impartial interpretation and application of the law, no matter which side wins or whose agenda might be advanced.

Brennan’s opinion is a straightforward, impartial application of the Supreme Court’s Establishment Clause precedents.

Those precedents admittedly can be confusing and even contradictory, but in this case, the 7th Circuit applied the right ones in the right way.