Julian Zelizer, a history and public affairs professor at Princeton University and a CNN political analyst, is the author of " The Fierce Urgency of Now: Lyndon Johnson, Congress, and the Battle for the Great Society ." He's co-host of the "Politics & Polls" podcast. The opinions expressed in this commentary are his own.

(CNN) Washington has been leaking like a sieve. Every day the news agenda has been driven by a torrent of leaks exposing details of the Russia investigation, the backroom intrigue in the Oval Office, and about private meetings that President Trump has conducted with other leaders.

The President has been on a tear as he attacks the people who are leaking information to reporters. Every time that he has been faced with a new story connected to the role of Russia in the election or about the allegations of obstruction of justice, President Trump has blasted the leakers.

When he is asked questions about what happened in his campaign or in the White House, he changes the subject to the issue of leaks. Trump, who has called leaks "criminal action, a criminal act," no longer expresses the kind of sympathy for leakers that he did during the campaign, when he praised WikiLeaks for its publication of emails relating to Hillary Clinton.

This past weekend, upon returning from overseas, he tweeted, "It is my opinion that many of the leaks coming out of the White House are fabricated lies made up by the #FakeNews media." Key members of his administration have been helping to deliver this message. On Meet the Press, Homeland Security Secretary John Kelly said that leaks about the bombing in England were "darn close to treason.

In his anger about leakers, President Trump is not alone among political figures. President Obama was notoriously aggressive in his policies toward leakers, to the consternation of many journalists and civil liberties lawyers.

One does not have to be a partisan Republican to share President Trump's concerns. Leaking information can be extremely dangerous to national security. It can undercut the ability of government to function, it can generate a dysfunctional culture of distrust in government, and it can put lives in danger.

Yet it is important to remember that some leaks have been vital to discoveries that protected and strengthened our democracy. These were leaks that resulted from members of the government who were frustrated and frightened by what they saw happening in the halls of power.

Most famous leak

The most famous leak of all came in 1971: the Pentagon Papers. A top military analyst named Daniel Ellsberg shared with the New York Times a top secret study from the Department of Defense that explored the real story of why the United States entered into the disastrous war in Vietnam and the many ways in which various presidential administrations had lied to the public.

The White House sued the Times to stop the publication of the study, but the Supreme Court ruled 6 to 3 in a landmark decision that the paper could publish the study. "Only a free and unrestrained press can effectively expose deception in government." The leaks were important to building support for the anti-war movement that ultimately helped bring the disastrous war to an end.

Not that long after the Pentagon papers, former Deputy Director of the FBI Mark Felt gave Washington Post reporters Bob Woodward and Carl Bernstein information that helped them to put together their famous stories about Watergate, stories that exposed the ways President Nixon had abused his power and led to his resignation.

In 2005, the Sunday Times of London published an article based on notes from a meeting of British Prime Minister Tony Blair's national security team, held before the war in Iraq, where officials were concerned that President Bush was basing the operation on faulty evidence about weapons of mass destruction. The story was important in providing support to the international coalition opposing the war.

The pressure and criticism eventually convinced President Bush to reorient his strategy in 2007 by implementing the "surge," which increased troops and refocused them on winning support from the local population. Edward Snowden has garnered praise from many on the left and some on the right for his decision to leak the evidence that exposed a massive government surveillance program.

Leaks not always virtuous

Not all leaks have been so virtuous. It's worth recalling the time during the George W. Bush administration that the identity of a CIA agent named Valerie Plame was leaked in an effort to discredit her husband, former US Ambassador Joe Wilson, for having questioned the administration's intelligence on Iraq. Deputy Secretary of State Richard Armitage later said he had revealed the name, almost inadvertently. The former chief of staff to Vice President Dick Cheney, Lewis "Scooter" Libby, was convicted of perjury, obstruction and lying to the FBI in investigation of the leak and his sentence was commuted by President Bush, but Libby was not accused of leaking Plame's name.

It is a mistake to discount all of these actions as "criminal activity."

There are times when our democracy depends on leaks to learn what is going on in the inner sanctums of Washington. Leaks are often produced by desperate civil servants who have no other option left other than to take their story to the press.

The problem in Washington today might not be the leaks, but the focus of the information being leaked -- and that's the President himself. There are clearly many officials in government who are worried about what is going on with this White House.

They fear that there is a President in power who is incapable of handling the responsibilities of his position and who, either willingly or through ignorance, is abusing his power. They are concerned that there could have been an attempt to undercut our presidential election by working with the Russians. They are upset about watching what they see as an irresponsible action by the President in sharing sensitive classified material from the Israelis with the Russians for no justifiable reason.

With President Trump, leaks are also a way to counteract the ongoing barrage of misleading or false information that is coming from the White House. Despite all of the President's complaints, the truth is that he is the biggest purveyor of fake news in Washington. He has used the bully pulpit of Twitter to make false accusations about individuals and institutions and to spread information that has no basis in fact -- from claims about massive voter fraud to charges that every story about his administration's connection to the Russians is simply a lie.

Follow CNN Opinion Join us on Twitter and Facebook

Faced with a fake news President, there are people in government who seem to be trying to leak the truth to reporters so that the country can have a better handle on what is going on. In this case, virtuous leakers are also combating the disinformation campaign that seems to be coming from the Russians.

It is also important to remember that determining the legality of leaks is not always clear-cut, with many of the recent leaks -- such as the Oval Office conversations with the President and Russian diplomats, or the reports on the memos about James Comey -- arguably within the boundaries of the law.

It is essential that we hold government officials accountable. Public access to the information that helps us to see the truth, especially in the fog created by the current White House, is vital. The leakers must not be allowed to break the law or to endanger lives, but that does not mean that some of their work is not crucial to safeguarding our democracy.

In an age when partisanship often obscures the facts and when a President and his media allies feel emboldened to traffic in falsehoods, the leakers could well be seen as performing a public service.

Correction: An earlier version of this article incorrectly described who leaked the identity of the CIA agent Valerie Plame.