A Lutheran pastor in Wisconsin intended to test new Internal Revenue Service rules and endorse a candidate from the pulpit before his plan went wrong and left him without a church.

The Rev. Jonathan Barker had planned to throw his support behind a Democratic candidate after the IRS appeared to carve out an exception to federal law prohibiting churches from making political endorsements, saying that should not apply to preachers speaking to their own congregations. Instead he lost his flock, reported the New York Times.

"Pastor Barker, an outspoken liberal, was ready for the change," the Times reported. "He had written a sermon urging Representative Alexandria Ocasio-Cortez, Democrat of New York, to run for president in 2028. His denomination, the Evangelical Lutheran Church in America, was not so ready."

"As a result, when Sunday came, Pastor Barker was no longer the pastor of Grace Lutheran," the newspaper added.

The pastor gave his sermon that Sunday, describing Ocasio-Cortez as a “what-would-Jesus-do candidate," but in a borrowed event space to a congregation of nine instead of his former church across town in Kenosha.

“I am very proud, as a pastor, to endorse AOC to be the love-your-neighbor presidential candidate,” he told the small gathering.

Two churches in Texas and a group of religious broadcasters had sued the IRS last year seeking to invalidate the 1954 Johnson Amendment revoking their tax-exempt status for endorsing political candidates, and the agency agreed to settle the case after President Donald Trump took office, loosening restrictions on individual pastors – which religious conservatives interpreted as a green light to activism.

“There’s 18,000 that’s ready to go,” Barker said, referring to the number of preachers the Family Research Council is trying to organize before next year's midterm elections, "and there’s none of us ready to go.”

The 41-year-old Barker had been trying to rejuvenate his church, which had dwindled from 1,500 attendees in the 1950s to 20 or 30 people on most Sundays, by focusing on liberal causes, and he did not provide advance notice to church leaders about his plan but instead sent out a news release to reporters, hoping to encourage other progressive-minded pastors to join him in advocacy.

“I said, ‘Jon, we just agreed as a group that this is not a good idea,’” said Bishop Paul D. Erickson, who oversees churches in southeast Wisconsin, after catching wind of the plan.

Erickson urged Barker to reconsider because his advocacy could potentially jeopardize the tax exemption for the denomination’s other churches.

“You are putting them at risk without their knowledge or consent,” Erickson said he told the pastor.

Instead, Barker resigned, leaving Erickson to face questions from the rest of their congregation.

"Their questions were not about politics," the Times reported. "Who had keys to the front door? Who knew the Facebook password? Would the diaper bank be discontinued? Was the church going to survive?"

"Bishop Erickson said they would figure the answers out together," the paper added.