President Obama’s administration has an unfortunate record of prosecuting whistleblowers, some of whom have been important sources for journalists.

That’s not a legacy any president should want.

In the waning days of his administration, the president can turn that around, not entirely, but in an important way by pardoning the former National Security Agency contractor Edward Snowden and allowing him to return to the United States from his Russian exile without facing charges.

Obama absolutely should do so. Snowden did an important — and brave — service for the American public and, in fact, the world, when he made it possible for news organizations to reveal widespread government surveillance of citizens. Some of that surveillance broke the law; some, although within the law, was nevertheless outrageous and unacceptable. And, afterward, some of the wrongs were righted through legislative reform.

One of the beneficiaries was The Washington Post, which won the Pulitzer Prize for public service for stories made possible by Snowden’s leak of thousands of documents. (The Guardian U.S. shared in that award, given in 2014.) Some see it, then, as hypocritical for The Post’s editorial board to weigh in against a pardon, as it did in Saturday’s paper — even though the editorial-writing side is separate from the newsroom.

Former National Security Agency contractor Edward Snowden and his allies are calling on President Obama to pardon him. Snowden presented his case via video link from Moscow, where he now lives. (Reuters)

In awarding its highest honor to both publications, the Pulitzer board cited The Post’s revelations “of widespread secret surveillance by the National Security Agency, marked by authoritative and insightful reports that helped the public understand how the disclosures fit into the larger framework of national security”; in the Guardian’s case, for aggressive reporting that sparked “a debate about the relationship between the government and the public over issues of security and privacy.”

At the time of the revelations, the president himself declared that national debate important and worthwhile, although he criticized Snowden for breaking the law in making the classified documents public.

“It is indisputable that our democracy is better off thanks to Snowden,” said American Civil Liberties Union Executive Director Anthony Romero in a statement this week. “And it’s precisely for cases like his that the pardon power exists.”

I can’t help but see this through the lens of journalism. The tiresome debate may rage on about whether Snowden is a traitor or a hero — no doubt to be rekindled with the arrival last week of “Snowden,” Oliver Stone’s take on the affair. What Snowden was, without dispute, was an extraordinarily important source. Without his decision to bring the information to journalists, it is very unlikely that we would know what we do about mass surveillance in the post-9/11 world.

And notably, Snowden brought those revelations to those he trusted — at first, to Laura Poitras, a filmmaker who later became one of the founders of the Intercept, along with Glenn Greenwald, who was then at the Guardian. Poitras worked with several news organizations, including The Post. Barton Gellman led The Post’s reporting, after receiving documents directly from Snowden.

Snowden worked through journalists, rather than publish documents en masse himself, because he wanted the information to be carefully handled and responsibly vetted. He has been critical, in recent weeks, of WikiLeaks because of that organization’s reckless just-publish-everything mentality.

In other words, Snowden acted carefully, responsibly and courageously — and squarely in the public interest.

The Post’s executive editor, Martin Baron, wrote this in 2014 about the revelations whose publication in The Post he championed: “In constructing a surveillance system of breathtaking scope and intrusiveness, our government also sharply eroded individual privacy. All of this was done in secret, without public debate, and with clear weaknesses in oversight.”

Snowden may indeed have broken the law when he decided his only acceptable path was to give the NSA documents to journalists.

But another famous and public-spirited leaker, Daniel Ellsberg, who provided the classified Pentagon Papers to the media in 1971, pointed out that there was a more important obligation at work. While they both signed a standard secrecy agreement as a condition of employment, Ellsberg said that their oath to defend the Constitution rightly took precedence: “As Snowden and I discovered, that oath turns out to be often in conflict with the secrecy agreement that he and I signed, and which we later chose to violate in support of our oath.”

Nothing but semantics? No, a crucial distinction.

Snowden made it possible for journalists to provide a historic public service to his country. And his country ought to show him some appreciation, not threaten him with imprisonment or keep him in exile.