WASHINGTON — A surprise move by the IRS that would allow pastors to back political candidates from the pulpit without losing their organization’s tax-exempt status is drawing praise from conservatives and even some progressive religious groups but concern from other leaders of faith, along with tax and legal experts.

A 1954 provision in the tax code called the Johnson Amendment says churches and other nonprofits could lose their tax-exempt status if they participate or intervene in any political campaign on behalf of or in opposition to any candidate for public office. The rule was rarely enforced.

While the IRS did not go as far as calling for the repeal of the Johnson Amendment, it said in court documents Monday that communications in good faith by a church to its flock does not amount to “intervening” or affecting the outcome of a political campaign.

“Communications from a house of worship to its congregation in connection with religious services through its usual channels of communication on matters of faith do not run afoul of the Johnson Amendment as properly interpreted,” the IRS said.

The new IRS interpretation came after decades of debate and, most recently, lawsuits from the National Religious Broadcasters association and other conservative churches complaining that the amendment violates their First Amendment rights, among other legal protections.

Speaking to reporters Wednesday, President Donald Trump called the IRS’ assessment “terrific.”

“I love the fact that churches can endorse a political candidate,” he said. “We have a lot of respect for the people that lead the church.”

While some congregations see a new freedom to speak openly about preferred candidates, others see openings for campaign finance corruption, new pressures on religious leaders and an overall entanglement between church and state.

Robert Jeffress, pastor of a Baptist megachurch in Dallas and a Trump ally, called it “the right decision.” He said his church’s tax-exempt status was threatened because of an IRS investigation into their political endorsements, costing the megachurch hundreds of thousands in legal fees.

“The IRS has no business dictating what can be said from the pulpit,” he said. “They need to stay the heck out of our churches.”

Calvary Church Chino Hills, a Southern California megachurch led by Jack Hibbs, has been endorsing candidates for years, particularly in local elections. Gina Gleason, director of the church’s political engagement team, said she hopes the move will encourage smaller churches previously hesitant for fear of triggering an IRS response.

“I’d have thought if the IRS had targeted any church it would’ve been us,” she said. “But we got sound legal advice from lawyers and religious liberty organizations that explained we were within our constitutional rights.”

For Democrats trying to connect with people of faith, this decision is timely, said Doug Pagitt, pastor and executive director of Vote Common Good, a progressive and evangelical Christian organization.

“Conservative pastors who have been blatantly endorsing candidates regardless of the Johnson Amendment over the years created a disadvantage causing Democrats to step away from faith voters,” he said. “There was a true imbalance between how many more opportunities there were for Republican voters.”