President Obama and his Justice Department need to get straight on the difference between espionage and news reporting. The administration appears to be on a campaign to harass journalists who are doing the job that the Constitution reserves for them.

Twice in recent weeks the administration has acknowledged spying on reporters. In the most recent case, Fox News reporter James Rosen was accused of being a co-conspirator in an effort to disclose confidential government information.

Obama’s spokesmen like to claim the president is merely seeking to balance the legitimate needs of national security with those of a free press, but when the government paints a reporter as a potential criminal for routinely doing his job, balance is nowhere to be found. This is an attack on the free press that no president should endorse.

The facts of this case would be comical if they weren’t aimed at the heart of the First Amendment. During an investigation of leaks regarding North Korea, law enforcement officials targeted State Department adviser Stephen Kim, and then obtained search warrants for some private emails of Rosen, the chief Washington correspondent for Fox News.

They also tracked his comings and goings from the State Department. In seeking its warrants, investigators labeled the reporter a co-conspirator and claimed there is probably cause to believe the reporter violated the law.

For doing his job.

An affidavit filed with the judge accused Rosen of “employing flattery and playing to Mr. Kim’s vanity and ego” in seeking the information. You don’t say? And who knew that flattery was a crime?

That tension exists between government and the news media is no surprise. It’s inherent in a relationship in which one tries to keep secrets – often for no better reason than to avoid embarrassment – while the other, empowered by the Constitution, seeks to ferret them out.

When reporters come upon information that could jeopardize national security, government officials usually make editors aware and may ask for a story to be dropped or at least delayed. Indeed, in the previous case, in which the government spied on the Associated Press, managers had agreed to delay a story about a failed al-Qaida plot.

There are ways for government and the media to resolve this issue, sometimes with the involvement of the courts. Those approaches have worked well for decades. But by targeting reporters, the Obama administration is taking a giant step outside the Constitution, in a blatant attempt to chill not just sources, but the news media, itself.

Yes, reporters are a pain in the neck to government officials. That is their job. Obama needs to back off and let them do it.