Updated

Missouri Attorney General Josh Hawley, the Republican nominee for U.S. Senate, wants to do away with a provision in the federal tax code that bars religious organizations and pastors from endorsing or opposing political candidates.

The St. Louis Post-Dispatch obtained audio of an Aug. 21 speech to religious leaders in St. Louis in which Hawley said he favors repealing the Johnson Amendment.

"Religious liberty is under attack in this country and it's a terrible thing. It's a dangerous thing," Hawley, who defended religious freedom cases before being elected attorney general in 2016, said in the speech.

Speaking at a Columbia, Missouri campaign event Tuesday, Hawley called the Johnson Amendment "unconstitutional."

"There is no excuse to silence churches and to silence pastors," he said. "That needs to end right now."

In a statement provided to The Associated Press, Hawley said Democrats including his opponent, Sen. Claire McCaskill, "need to stop trying to muzzle people of faith." A spokesman for McCaskill said she opposes repealing the Johnson Amendment.

Under the IRS regulations, churches and other nonprofits can engage in a wide range of activity related to public issues, such as advocating for certain policies. However, pastors and churches are not allowed to endorse a particular candidate in a sermon or during church services without potentially losing their status as an organization exempted by the government from paying taxes. Even so, the IRS rarely enforces the rule.

Supporters of the amendment say easing restrictions on churches could transform donations to churches into tax-free campaign contributions. Currently, charities that violate the prohibition risk losing their tax exemption with the Internal Revenue Service. They also risk a fine.

President Donald Trump in 2017 said he wanted to get rid of the law, prompting a coalition of more than 4,000 faith leaders to write to Congress urging members to retain it.

"As a leader in my religious community, I am strongly opposed to any effort to repeal or weaken current law that protects houses of worship from becoming centers of partisan politics," Americans United for Separation of Church and State said in the letter. "Changing the law would threaten the integrity and independence of houses of worship."

Trump in May signed an executive order that asked the IRS not to enforce the amendment. In July, the House Appropriations Committee voted to keep language in a spending bill that would defund IRS efforts to enforce the amendment. The bill must be passed by the House and the Senate before it can be signed into law by the president.

Hawley has made religion an issue before. In February, he told pastors in Kansas City that modern-day sex trafficking was caused by the sexual revolution.

"You know what I'm talking about, the 1960s, 1970s, it became commonplace in our culture among our cultural elites, Hollywood, and the media, to talk about, to denigrate the biblical truth about husband and wife, man and woman," Hawley said at the time.

The latest speech in St. Louis was sponsored by the Family Research Council, which promotes family values and lobbies for social conservative issues.