President Trump last week promised to repeal a law that prohibits tax-exempt religious organizations from endorsing political candidates. As he put it at the National Prayer Breakfast in his characteristically bombastic style, he would “totally destroy” the ban, pushed through Congress in 1954 by Sen. Lyndon Johnson.

The proposal, predictably, was met with opposition by many observers, who argued that such a move would threaten the constitutionally mandated separation of church and state.

“Eliminating the endorsement rule would mean that your tax dollars would now indirectly subsidize a church’s support for a particular political candidate,” wrote Steven Waldman in The New York Times. Although it is generally religious conservatives who support the change, Waldman conjured up the specter of subsidizing the Rev. Al Sharpton’s political activities, or churches that support pro-choice candidates, or — heaven forbid! — a politically active mosque.

There’s little doubt that repealing the Johnson Amendment would have consequences, some of them unintended. And yet I think Trump is right, as I said on WGBH-TV's "Beat the Press" last Friday. The evidence suggests that Johnson himself acted not out of principle but out of pique — and that religious organizations were collateral damage.

Johnson was running for re-election in 1954. His opponent in the Democratic primary was a wealthy 30-year-old named Dudley Dougherty. Effectively there was no Republican Party in Texas in the 1950s, so the primary was tantamount to the general election. Dougherty had no real chance of beating Johnson. As LBJ biographer Robert A. Caro wrote in his book “Master of the Senate,” Dougherty was considered by Johnson’s supporters to be a “screwball” and a “nut.” From the back of his campaign vehicle — a red fire truck — Dougherty denounced Eleanor Roosevelt as “an old witch” and claimed that he was the only Texas politician who was not afraid of “sinister, hidden powers.”

But a nonprofit group aligned with Sen. Joseph McCarthy called the Committee for Constitutional Government attacked Johnson on Dougherty’s behalf. And the prickly Johnson took action, pushing through a change in the Internal Revenue Service’s tax code so that 501(c)(3) organizations could not work on behalf of a political candidate without losing their tax-exempt status. The change applied to a wide range of educational and charitable organizations, including the Committee for Constitutional Government. And, as it turned out, religious organizations.

Years later, Johnson’s chief aide, George Reedy, told a researcher, Deirdre Dessingue Halloran, that Johnson may very well have acted to punish his critics back home. “Lyndon B. Johnson was very thin-skinned,” Reedy said, adding: “The language used by the conservatives during that campaign was vicious.” Reedy went on to say he was “confident that Johnson would never have sought restrictions on religious organizations, but that is only an opinion and I have no evidence.” (Halloran and a co-author, Kevin M. Kearney, reported their findings in the academic journal Catholic Lawyer in 1998.)

Trump's promise to get rid of the Johnson Amendment may have been motivated solely by his desire to pander to the evangelical Christian pastors who helped him get elected. But that doesn't mean he's wrong.

Granted, the world has changed a lot since 1954. The confluence of money and politics is worrisome enough without the prospect of nonprofit organizations endorsing political candidates. And contrary to the examples offered by Waldman in his Times op-ed, the far more likely scenario is that religious-right leaders such as the Revs. Franklin Graham and Pat Robertson would be able to make their political preferences even more explicit than they already do.

But some good would come of repeal, too. Consider, for example, community-based nonprofit news organizations. My 2013 book “The Wired City” is largely the story of one such organization, the New Haven Independent, a website that is funded by tax-exempt donations and grants.

New Haven’s board of aldermen comprises 30 members. The Independent does an admirably thorough job of covering every one of those contests. Yet it is prohibited from endorsing, even though its readers might well appreciate some guidance in sorting through the candidates in obscure neighborhood races.

Paul Bass, the founder and editor, told me he wasn’t interested in endorsing candidates. “We’re getting to be more important in helping people sift through the information on the web, less important in terms of trying to convince them to do things,” he said. “I love that. I have no desire to write an endorsement editorial ever again in my life.” That is Bass’ prerogative. But it shouldn’t be dictated by the federal tax code.

Trump’s promise to get rid of the Johnson Amendment (factual aside: repeal would have to be approved by Congress) may have been motivated solely by his desire to pander to the evangelical Christian pastors who helped him get elected. But that doesn’t mean he’s wrong.

Religious leaders — and everyone — should be able to speak freely without fearing that their words will cost them money. Somehow the republic managed to survive until 1954 without those free-speech rights being abridged. There is no reason to think that restoring those rights will be our downfall today.