President Trump lashed out Wednesday at Sen. Chris Murphy for meeting with Iran's foreign minister and accused the Democratic senator of "illegally" violating the Logan Act.

The Logan Act, enacted in 1799, bars Americans from conducting rogue negotiations with foreign governments in disputes with the U.S.

SENATE DEMOCRAT MURPHY ACKNOWLEDGES MEETING WITH IRAN'S FOREIGN MINISTER

No one has ever been successfully prosecuted under this obscure federal law, but some critics suggested in 2017 that Trump's former national security adviser Michael Flynn ran afoul of the law in his dealings with Russia before Trump took office. Murphy himself called for investigations at the time. Trump on Wednesday argued the Connecticut senator is now the one in breach of that law, suggesting he face consequences.

"Kerry & Murphy illegally violated the Logan Act," Trump tweeted Wednesday, in reference to former Secretary of State John Kerry as well. "This is why Iran is not making a deal. Must be dealt with strongly!"

Murphy met with Iran's Foreign Minister Mohammad Javad Zarif while at the Munich Security conference declaring, "if Trump isn’t going to talk to Iran, then someone should."

Once hearing the news of Murphy's visit, Trump previewed his line of attack to reporters.

“I saw that Senator Murphy met with the Iranians, is that a fact?” Trump said Tuesday before boarding Air Force One.  “I just saw that on the way over. Is there anything I should know? Because that sounds like, to me, a violation of the Logan Act."

Trump has previously accused Kerry of meeting the Iranians and trying to undermine his foreign policy.

CLICK HERE TO GET THE FOX NEWS APP

A spokesperson for Kerry responded Wednesday: “We've addressed this many times before. The president is still tweeting, is still wrong, and is still trying to distract from his diplomatic malpractice on Iran."

Flynn wasn't prosecuted for Logan Act violations, but in 2017 he pleaded guilty to making false statements to the FBI in relation to the Russia probe.

Fox News' Rich Edson contributed to this report.