In a break with decades of tradition, the Internal Revenue Service says it will allow houses of worship to endorse candidates for political office without losing their tax-exempt status.

The surprise announcement came in a court document filed on Monday.

Since 1954, a provision in the tax code called the Johnson Amendment says that churches and other nonprofit organizations could lose their tax-exempt status if they participate in, or intervene in “any political campaign on behalf of (or in opposition to) any candidate for public office.”

The National Religious Broadcasters and several churches sued the IRS over the rule, arguing that it infringes on their First Amendment rights to the freedom of speech and the free exercise of religion.

The IRS rarely enforced the rule. During President Trump’s first term, he promised to “get rid of and totally destroy the Johnson Amendment and allow our representatives of faith to speak freely and without fear of retribution.”