Trump calls for John Kerry to be prosecuted for Iran talks amid heightened tensions President Donald Trump went after former Secretary of State John Kerry Thursday.

President Donald Trump went after former Secretary of State John Kerry again Thursday, calling for the former senator and top U.S. diplomat to be prosecuted for meeting with Iranian leaders and "telling them what to do."

It's an accusation that Kerry strongly denies and that legal scholars question the merits of as well. A source close to Kerry said that he has not talked to Iranian leaders since Trump withdrew from the Iran nuclear deal.

Trump's charges against Kerry come as his own administration has heightened tensions with Tehran. U.S. officials said Iran and its proxies were preparing an attack against U.S. forces in Iraq, sending an aircraft carrier strike group to the region and deploying Secretary of State Mike Pompeo to Baghdad in a show of force.

Senior Trump aides met at the White House on Thursday to discuss next steps, with concerns growing about a clash between the two sides. But the president said he was not interested in war with Iran; he wanted to talk to Iranian leaders, but it was Kerry who has blocked that, according to the president.

"John Kerry tells them not to call. That's a violation of the Logan Act, and frankly he should be prosecuted on that, but my people don't want to do anything," he said Thursday during a White House announcement on cutting costs for medical expenses.

The Washington Post via Getty Images, FILE

Trump has repeatedly called for the prosecution of certain political opponents, including Hillary Clinton, Kerry's predecessor at the State Department and a fellow Democratic presidential candidate. But the president made it seem as if he had discussed prosecuting Kerry with some advisers. The White House did not respond to questions about that.

"He's talking to Iran and has been -- has many meetings and many phone calls, and he's telling them what to do. That is a total violation of the Logan Act," Trump continued.

While Kerry has said publicly that he's spoken to Iranian Foreign Minister Javad Zarif before Trump withdrew from the Iran nuclear deal, a source close to him said that he has not talked to Iranian leadership since then.

Rick Wilking/AFP/Getty Images, FILE

"When he did before then, it was to urge them to stay in the deal," the source said. "And no, of course he has never discouraged a call. He's urged everyone on all sides to talk and use diplomacy."

Kerry himself denied Trump's accusations through a spokesperson, who told ABC News on Thursday that, in part, "Everything President Trump said today is simply wrong, end of story. He's wrong about the facts, wrong about the law and sadly he's been wrong about how to use diplomacy to keep America safe."

The Iranian government also denied contacts with Kerry, with Ambassador Majid Takht Ravanchi telling MSNBC, "This is something new to us, that John Kerry has told us to not talk to the current president or his administration."

Saul Loeb/AFP/Getty Images, FILE

The law in question -- the Logan Act -- is an arcane statute that has received renewed attention in recent years. Signed into law in 1799, it penalizes private individuals for negotiating or collaborating with foreign governments on issues involving the United States without the federal government's permission. There has only been one indictment under the law -- in 1803 against a Kentucky farmer who wrote an op-ed calling for western states to secede and ally themselves with France -- and the charges were ultimately dropped. No one has ever been prosecuted under the law.

It is "unclear whether the federal government does in fact have the power to limit this particular speech and whether the statute is overbroad in its coverage," according to a 2010 article in the Houston Journal of International Law.

But throughout the years, politicians have used it to bully opponents, urging prosecution of them for what could be seen as traitorous behavior. Critics argued Trump's first national security adviser Michael Flynn should've been prosecuted for urging Russia to veto a United Nations Security Council resolution on Israeli settlements in the Palestinian territories that the Obama administration was going to abstain on and see passed. Russia ultimately voted in favor of the resolution

ABC News's Cindy Smith contributed to this report.