Religiously affiliated hospitals, as well as other religious non-profit organizations, are exempt from the requirements of a federal pension law, the U.S. Supreme Court unanimously ruled on Monday.

Known as Advocate Health Care Network v. Stapleton, the case involved whether three religiously affiliated hospitals must afford the same requirements under the Employee Retirement Income Security Act (ERISA) of 1974 as other private corporations do. Employers have minimum funding requirements, among others, under ERISA.

Church pension plans are exempt from ERISA, and a portion in the law includes language that the Supreme Court interpreted on Monday to mean that religiously affiliated organizations are also included in that exemption.

“A plan maintained by a principal-purpose organization qualifies as a ‘church plan,’ regardless of who established it,” the opinion written for the court by Justice Elena Kagan states.

ERISA states that a church plan that was “established and maintained” by a church also “includes a plan maintained” by outside organizations that are “controlled by or associated with a church,” which are also called principal-purpose organizations.

“That use of the word ‘include’ is not literal, but tells readers that a different type of plan should receive the same treatment (i.e., an exemption) as the type described in the old definition,” the opinion states. “In other words, because Congress deemed the category of plans ‘established and maintained by a church’ to ‘include’ plans ‘maintained by’ principal-purpose organizations, those plans — and all of those plans — are exempt from ERISA’s requirements.”

Employees of Advocate and two other religiously affiliated hospitals (Saint Peter’s Healthcare System and Dignity Health) argued that the hospitals were essentially large organizations using their religious affiliation to opt out of the ERISA requirements.

“The decision avoids deciding whether large non-profit hospital systems meet the requirements for the exemption,” said Karen Handorf, who represented the employees.

Justice Sonia Sotomayor expressed a similar concern in a separate opinion in which she said she agreed with the court’s interpretation of the existing statute, but suggested Congress reconsider the current law.

Large religious organizations such as Dignity Health “bear little resemblance to those Congress considered when enacting the 1980 amendment to the church plan definition,” she wrote. “This current reality might prompt Congress to take a different path.”

Supporters of the hospitals celebrated the victory, saying that church activities are not limited to the church buildings themselves.

“Churches — not government bureaucrats and certainly not ambulance chasers — should decide whether hospitals are part of the church,” said Eric Rassbach, deputy general counsel at Becket, a law firm which filed an amicus brief supporting the hospitals.

“It is simple common sense that nuns, soup kitchens, homeless shelters, seminaries, nursing homes, and orphanages are a core part of the church and not an afterthought.”

If the Supreme Court had ruled in favor of the employees, the hospitals would have been required to pay up to billions of dollars in retroactive penalties.

Justice Neil Gorsuch did not take part in the decision, as the case was argued in March before he was confirmed to his position in the Supreme Court.