Former Secretary of State John Kerry would be violating the Logan Act, if it was enforced, for secretly speaking with foreign leaders about salvaging the Iran nuclear deal during Trump’s presidency, Harvard Law School professor emeritus Alan Dershowitz argued Saturday.

[Related: John Kerry-Iran deal report sparks chatter about potential Logan Act violation]

No one has ever been prosecuted under the Logan Act, a more than 200-year-old law that prohibits private citizens from acting on behalf of the U.S. in negotiations with foreign governments without authorization.

“Fortunately for everybody, the Logan Act [is a] dead letter but if it were in existence, my friend John Kerry would be violating the Logan Act,” Dershowitz told “Fox & Friends.”

“He is negotiating, though he is not in the administration, and there are real problems with doing that,” he continued.

Kerry has reportedly engaged in shadow diplomacy with foreign leaders to discuss ways of preserving the nuclear deal that he helped construct under the Obama administration.

[Opinion: The other collusion: John Kerry's 'shadow diplomacy' to save the Iran deal]

Trump has indicated that he plans to pull out of the deal if it’s not changed, despite protests from America’s European allies. The president has until May 12 to make a decision on whether the U.S. will remain in the pact that stalled Iran’s nuclear program in exchange for relief from crippling sanctions.

Former Acting Attorney General Sally Yates, who was fired by Trump, pointed to the Logan Act when it was discovered that former national security adviser Michael Flynn discussed policy issues with a Russian envoy after Trump was elected but before former President Barack Obama left office.

“John is a friend of mine. I've known him for a long, long time. But remember how this investigation against Trump begins,” Dershowitz said. “It begins by the theory that people in the Trump campaign may be violating the Logan Act, by going and speaking to people when they haven't yet been president.”