JEFFERSON CITY — 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 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.

In a statement his campaign provided Tuesday to The Associated Press, Hawley called the Johnson Amendment "unconstitutional."

"The government shouldn't be telling pastors what they can and can't say from their pulpit," Hawley said. "In the history of this nation, there has been no greater force for good than the preaching of pastors and the speech of religious believers." He 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.

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.