President Trump on Thursday said former secretary of state John F. Kerry should be prosecuted for discussing the Iran nuclear deal with officials from that country after leaving office.

The president raised the issue during a freewheeling exchange with reporters after an event on health care at the White House, accusing Kerry of telling Iranian officials not to speak with members of the Trump administration.

“I’d like to see — with Iran, I’d like to see them call me,” Trump said. “You know, John Kerry speaks to them a lot. 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 that’s — only the Democrats do that kind of stuff, you know? If it were the opposite way, they’d prosecute him under the Logan Act.”

As President Barack Obama’s secretary of state, Kerry helped craft the 2015 Iran nuclear deal, which Trump scrapped.

Trump has long accused Kerry of holding “illegal” meetings with Iranian officials and has argued that the former secretary of state violated the Logan Act, which prohibits private citizens from negotiating on behalf of the U.S. government without authorization.

Thursday appears to be the first time Trump has publicly acknowledged that he asked members of his administration to examine whether they could prosecute Kerry.

Matt Summers, a spokesman for Kerry, disputed Trump’s accusations and urged the president to “focus on solving foreign-policy problems for America instead of attacking his predecessors for theater.”

“Everything President Trump said today is simply wrong, end of story,” Summers said in a statement. “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. Secretary Kerry helped negotiate a nuclear agreement that worked to solve an intractable problem. The world supported it then and supports it still.”

A Justice Department spokeswoman did not return a message seeking comment on Trump’s remarks.

In a radio interview in September, Kerry said he had met with Iranian Foreign Minister Mohammad Javad Zarif “three or four times” since leaving office and that their discussions included the Iran nuclear deal.

Kerry also defended the meetings in an interview that month on Fox News Channel, stating that “every secretary of state, former secretary of state, continues to meet with foreign leaders.”

Days after the interviews, Sen. Marco Rubio (R-Fla.) sent a letter to then-Attorney General Jeff Sessions urging the Department of Justice to investigate whether Kerry was in violation of the Logan Act or the Foreign Agents Registration Act. The latter applies to people who represent the interests of foreign governments in a “political or quasi-political capacity.”

“The American people deserve to know that U.S. laws are enforced regardless of any individual’s past position,” Rubio wrote in the letter.

Shortly after Trump’s remarks about Kerry on Thursday, Matt Wolking, a spokesman for Trump’s presidential campaign, cited Rubio’s letter in a tweet. The letter, he said, “details Kerry’s attempts to thwart the Trump Administration’s foreign policy and save Obama’s disastrous Iran deal.”

Matt Zapotosky and John Wagner contributed to this report.