It’s hard to imagine a politician loving the news media unconditionally, so it’s probably not surprising that President Barack Obama had some critical comments to make about the press in a speech on Monday night. But the commander-in-chief’s remarks were particularly difficult to take for some, given the way his administration has treated the media.

The President was speaking at a dinner held in Washington to honor the winner of the Toner Prize, an award for political reporting named after Robin Toner, a New York Times correspondent who died in 2008.

In what appeared to be a reference to the campaign of Republican presidential candidate Donald Trump, Obama said, “A job well done is about more than just handing someone a microphone. It is to probe and to question, and to dig deeper, and to demand more. The electorate would be better served if that happened. It would be better served if billions of dollars in free media came with serious accountability.”

The “free media” comment seemed to be a direct reference to a recent estimate by the New York Times that suggested Donald Trump has gotten the equivalent of almost $2 billion in media coverage since his campaign began. So perhaps the President agrees with those who argue that the news media has helped create the phenomenon that is Donald Trump.

The President went on to praise the “deep reporting, the informed questioning, the in-depth stories” that the Toner Prize celebrates, which he said “lasts longer than some slapdash Tweet that slips off our screens in the blink of an eye, that may get more hits today, but won’t stand up to the test of time.”

Many journalists would probably agree with Obama’s remarks about digging deeper and demanding more as well as focusing on long-lasting journalism as opposed to dashing off tweets. But when reporters have tried to do this with the White House and the rest of the Obama administration, they have been stymied at every turn, and in some cases, they have even been threatened with prosecution.

Sign up for Data Sheet, Fortune‘s technology newsletter.

As investigative reporter John Russell pointed out in a response to the President’s criticisms on Twitter, the Obama administration holds the record for denying or withholding the largest amount of Freedom of Information requests. How is that helping the news media to “dig deeper” or “demand more” accountability? Former New York Times executive editor Jill Abramson has said the Obama government is “the most secretive White House I have ever been involved in covering.”

It’s not just FOIA requests. The Obama government has also gone after journalists for doing their jobs—journalists like New York Times reporter James Risen, who was threatened with a jail term for refusing to divulge the name of a former CIA agent who leaked information about the U.S. military’s nuclear program. Risen has called Obama “the greatest enemy of press freedom in a generation.”

Former Washington Post executive editor Leonard Downie looked at the Obama government’s track record on secrecy in 2013, and didn’t like what he found. Among other things, the federal government used a secret subpoena to compel the Associated Press to release two months worth of phone records for the 20 phone lines used by more than 100 AP reporters in three news bureaus, as well as the House of Representatives.

In another case, the Justice Department seized the phone records of Fox News reporter James Rosen as well as his personal email logs, tracked his visits to the State Department and his phone conversations with a security adviser there who was later charged with leaking information about North Korean nuclear weapon testing. In the secret search warrant used to tap Rosen’s records, he was described as “a co-conspirator.”

Watch: “We want to make media for the way the world is today.”

In his speech this week, the President also criticized the splintering or Balkanization of the media, in which news consumers stick to channels or sources that cater to their existing prejudices, whether it’s Fox News, YouTube, or Reddit. Yet, as the Washington Post pointed out in a response to the speech, Obama has also been part of this problem.

The administration likes to talk about how open and transparent it has been with the media, and yet much of Obama’s dealings with the press have focused on specific digital outlets such as Reddit and YouTube with events on these channels being criticized as lightweight, rather than in-depth interviews with the traditional media. As the Post put it:

When it comes to granting interviews, he very often favors media that target particular slices of the electorate that are largely aligned with him already: left-leaning comedians, bloggers, YouTubers and podcasters. He is more reluctant to submit to questioning by mainstream news outlets and conservative publications that would push back harder on issues on which his opponents disagree with him.

On the one hand, it’s a good thing that the President has been more open to new media than any of his predecessors, using Twitter and Instagram and Facebook to connect directly with Americans. But journalists who have been frozen out by the Obama administration complain that this feel-good strategy also acts as an end-run around the traditional media, and this strategy has insulated the government from direct questioning.

So what the President seems to mean when he asks for a strong press that is willing to dig deeper and ask the hard questions is that he would like the media to do that to his opponents—but not necessarily to him or his administration.