Allies to former President Obama and former Obama administration officials worked for months to secretly undermine now-former White House National Security Adviser Michael Flynn in the national media and salvage the Iran nuclear deal, the Washington Free Beacon is reporting.

Flynn, a longtime critic of the Iran deal, resigned Monday night following reports that he misled Vice President Mike Pence about the details of his phone call with the Russian ambassador during the transition. Flynn is accused of discussing sanctions against Russia during the call, but he denied those charges in an interview with The Daily Caller News Foundation.

The Free Beacon cites “multiple sources in and out of the White House” who were aware of the months-long campaign to undermine Flynn.

Former Obama adviser Ben Rhodes, who bragged about creating an “echo chamber” in the media to help sell the Iran deal to the public, was reportedly among those leading the effort to publicly discredit Flynn.

The purpose of the anti-Flynn campaign, according to the Free Beacon, was “to handicap the Trump administration’s efforts to disclose secret details of the nuclear deal with Iran that had been long hidden by the Obama administration.” Flynn was reportedly gearing up to publicize details of the Iran deal that the Obama administration had kept secret from the public.

“It’s undeniable that the campaign to discredit Flynn was well underway before Inauguration Day, with a very troublesome and politicized series of leaks designed to undermine him,” one source close to the White House told the Free Beacon.

President Trump said Tuesday that the “real story” is not Flynn’s departure, but rather the “illegal leaks” that resulted in the former four star general submitting his resignation Monday night.

Flynn echoed that sentiment in his interview with TheDCNF shortly before his resignation. (RELATED: In Final Interview, Defiant Flynn Insists He Crossed No Lines, Leakers Must Be Prosecuted)

“In some of these cases, you’re talking about stuff that’s taken off of a classified system and given to a reporter. That’s a crime,” Flynn said. “You call them leaks. It’s a criminal act. This is a crime.”

Follow Hasson on Twitter @PeterJHasson