Pot, meet kettle.

When former President Barack Obama blasted President Trump in a blistering speech that derided his successor’s frequent clashes with the press, he skirted the fact that his own administration surveilled reporters – and even polygraphed intelligence agency employees – in an effort to nail leakers.

“It’s probably a good time to remind you that Obama used the Espionage Act to go after whistleblowers who leaked to journalists more than all previous presidents combined,” GOP consultant Caleb Hull tweeted.

“It shouldn’t be Democratic or Republican to say that we don’t threaten the freedom of the press because they say things or publish stories we don’t like,” Obama said at the University of Illinois’s Urbana-Champaign campus on Friday, in his first overt foray back into politics since Trump’s inauguration.

“I complained plenty about Fox News, but you never heard me threaten to shut them down, or call them ‘enemies of the people,’” Obama said.

But in 2010, Obama’s Department of Justice began secret surveillance of James Rosen, then Fox News’ chief Washington correspondent, in the wake of his reports on American monitoring of North Korea’s nuclear program.

They collected Rosen’s phone conversations and emails with sources – and even kept tabs on the reporter’s parents – and accused the reporter of being the “co-conspirator” of a State Department whistleblower. The surveillance did not come to light until 2013.

Obama’s DOJ also seized records for 20 phone lines at the Associated Press – used by more than 100 reporters – in 2013, and subpoenaed emails and calls between New York Times reporters and government officials.

The incidents, part of the administration’s crackdown on Washington leakers, were detailed in a highly critical 2013 report by the Committee to Protect Journalists.

In Friday’s speech, Obama warned against Trump’s threats to “pressure the attorney general or the FBI to use the justice system as a cudgel to punish our political opponents.”

The criticism came as Trump called on Attorney General Jeff Sessions to seek out the anonymous administration official who published an anti-Trump op-ed on Wednesday.

But Obama’s own administration used the justice system to prosecute eight people for leaking national security secrets under the Espionage Act.

As part of that effort, James Clapper, Obama’s director of national intelligence, announced in June 2012 that employees of 16 intelligence agencies would be subject to stringent polygraph tests and quizzed about their communications with reporters.

The administration dubbed their plan the “Insider Threat Program.”

Many sources took to talking to reporters only through middle men and couriers, in hopes of passing their regular lie-detector tests, according to the CPJ report.

“There’s no question that sources are looking over their shoulders,” Michael Oreskes, a senior managing editor of The Associated Press, said in 2013.

Obama hit the campaign trail in earnest Saturday, with a visit to Orange County, Calif., to boost a group of seven Democrats running for Congress.