The decade-long clandestine U.S. “war on terror” has spawned a parallel, escalating campaign to stop leaks of information about intelligence activities to the news media. During the first four years of the Obama administration, investigations of spy agency employees have proliferated. Six current or former officials have been prosecuted for unauthorized disclosures of information, more than in all previous administrations combined.

The pressure to keep quiet is intensifying. The director of national intelligence has expanded the use of lie-detector interrogations in leak investigations. His office is studying how all 16 U.S. civilian and military intelligence agencies handle “non-incidental contacts” with the news media, presumably interviews and background briefings. Pentagon officials have been ordered to monitor news media for disclosures of classified information.

Now the Senate is considering legislation that would go even further. The 2013 Intelligence Authorization Act would make it a crime for career intelligence officers to provide almost any type of information to the news media, whether the information is classified or not. The bill specifically prohibits a career official from participating in “background or off-the-record” sessions with reporters.

This is a classic example of overkill. The legislation would end contacts that often benefit both the government and the public by allowing the exchange of accurate information about vital national security issues and intelligence activities, including abuses requiring attention. As executive editor of The Washington Post for 17 years, I know firsthand that such conversations also help the news media avoid publishing information that, inadvertently, might harm national security.

The legislation is pending before the Senate, following its approval by the Senate Intelligence Committee over the summer. The only committee member to vote against the bill, Sen. Ron Wyden (D-Ore.), has placed a hold on it to prevent passage in its current form. “Without transparent and informed public debate on foreign policy and national security topics, American voters would be ill-equipped to elect the policymakers who make important decisions in these areas,” Wyden said in announcing his hold.

The governmentmust keep some secrets, but excessive secrecy can erode credibility and breed excesses. How can the government build public support for aggressive counterterrorism measures if it operates primarily in the shadows?

“There is no perfect solution to this problem,” said Harvard law professor Jack Goldsmith, who served in the George W. Bush administration’s Office of Legal Counsel, part of the Justice Department. His recent book, “Power and Constraint: The Accountable Presidency After 9/11,” explores the tension between protecting necessary secrets and telling citizens what they should know, too much of which Goldsmith believes is classified as secret.

“Leaks can serve a really important role,” he told me, “in helping to correct government malfeasance, to encourage government to be careful about what it does in secret and to preserve democratic processes.”

The 2001 terrorist attacks on New York and the Pentagon fundamentally reshaped American attitudes about national security. With Congress’s approval, the Bush administration launched a series of extraordinary counterterrorism measures, many of which have continued under President Obama. To carry out their mandated mission, intelligence agencies created an expensive, sprawling network of government bureaucracies and private companies engaged in countless top-secret activities at hundreds of locations throughout the country. The CIA detained and coercively interrogated terrorism suspects in “black site” prisons in foreign countries. The National Security Agency wiretapped and monitored phone calls and other communications without warrants. The CIA has used armed drone aircraft to kill terrorist leaders in several countries. And U.S. intelligence has mounted cyberattacks on Iran.

Americans know much of this because of news media reports, pieced together through contacts with multiple government sources, some of whom were worried about the legality and accountability of these covert activities. Editors joined the discussions before deciding what to publish and what to withhold. Sometimes, other government officials were interviewed to establish whether publication could harm American lives or national security.

These are just the sorts of contacts that the pending legislation would rule out. That would be a mistake. A specific case may help explain why.

In 2005, Post reporter Dana Priest wrote a story that described how the CIA was “hiding and interrogating” terrorism suspects in “a covert prison system set up by the CIA nearly four years ago that at various times has included sites in eight countries, including . . . several democracies in Eastern Europe.” Priest reported an ongoing debate within the agency “about the legality, morality and practicality” of the black-site program. Her story led to the closing of secret prisons and played a role in subsequent congressional and judicial actions that exposed and curbed the inhumane treatment and interrogation of terrorism suspects.

It was the culmination of many months of reporting by Priest, including earlier incremental stories, based on conversations with intelligence officials and other sources. She also discovered details of other counterterrorism efforts with Eastern European countries hosting CIA black sites. Through contact with her sources, she kept her editors informed about government concerns that publication of certain information might cause damage to national security. Our discussions centered on whether the damage seemed real and whether it outweighed the public’s interest in learning those specific details.

Post editors agreed to meet with the directors of national intelligence and the CIA, and then later with Bush and Vice President Dick Cheney, to listen to their concerns. As executive editor, I decided to publish the secret-prisons story, but without the names of the Eastern European countries because, as the story stated, “the disclosure might disrupt counterterrorism efforts in those countries and elsewhere and could make them targets of terrorist retaliation.”

Except for the meetings with top intelligence officials at CIA headquarters, and with the president and vice president in the White House, Priest’s conversations with government officials over many months may not have occurred under the restrictions in the pending Senate legislation.

The most troubling provision in the bill would prohibit all contact with the news media or “any person affiliated with the media” by any intelligence officials other than an agency’s director, deputy director or “specifically designated” public affairs officers — all of whom are political appointees. That could limit the flow of intelligence information to what political appointees decide to tell reporters, in “authorized leaks,” for political purposes. Reporters could be cut off from more knowledgeable and impartial career analysts, such as those who disclosed, in the run-up to the Iraq war, their doubts about Bush administration claims of Iraqi weapons of mass destruction.

This prohibition “would make everyday reporting about everyday intelligence activities practically impossible,” Jack Goldsmith told me. “It would promote opportunistic spinning by the executive branch, which is already a problem.”

Another provision in the bill would pressure the Justice Department to be more aggressive in approving subpoenas of reporters to compel them to cooperate in leak investigations. Since the 1970s, the department has had a policy of approving subpoenas of reporters in federal investigations only if “all reasonable attempts” have been made to obtain the information elsewhere and if the attorney general signs off after negotiations with the news organization.

“Because freedom of the press can be no broader than the freedom of reporters to investigate and report the news,” the policy states, “the prosecutorial power of the government should not be used in a way that it impairs a reporter’s responsibility to cover as broadly as possible controversial public issues.”

The Senate Intelligence Committee cited no evidence that this policy is no longer workable, even in national security investigations. In fact, the executive branch already has abundant legal tools, which the Obama administration has used aggressively, to investigate sources of national security leaks.

One of those tools, the Intelligence Identities Protection Act (IIPA), was recently used to prosecute a former CIA counterterrorism operative, John Kiriakou, who pleaded guilty to disclosing the name of a covert intelligence agent to a reporter investigating coercive interrogations of terrorism suspects. Earlier, Kiriakou gave an interview to ABC News in which he said the interrogation technique called waterboarding is torture.

In an Oct. 23 statement to CIA employees, then-Director David H. Petraeus made clear the message sent by Kiriakou’s conviction. “This case yielded the first IIPA successful prosecution in 27 years, and it marks an important victory for our Agency, for our Intelligence Community, and for our country,” Petraeus told them. “Oaths do matter, and there are indeed consequences for those who believe they are above the laws that protect our fellow officers and enable American intelligence agencies to operate with the requisite degree of secrecy.”

In this digital age, information about U.S. intelligence activities can come from myriad, often unreliable sources — including Congress itself. Those sources aren’t covered by the Senate legislation. Without access to knowledgeable career officials, it would be much more difficult for the news media to determine the accuracy of information or whether its publication or broadcast could truly harm national security.

Especially in times of war, declared or undeclared, it is important to maintain the right balance between accountability and national security. The Senate legislation could tip that balance dangerously.

Leonard Downie Jr., vice president at large of The Washington Post, served as the newspaper’s executive editor from 1991 to 2008. He also is a professor at Arizona State University’s Walter Cronkite School of Journalism and Mass Communication.

Read more from Outlook, friend us on Facebook, and follow us on Twitter.

Leonard Downie Jr., vice president at large of The Washington Post, served as the newspaper’s executive editor from 1991 to 2008. He also is a professor at Arizona State University’s Walter Cronkite School of Journalism and Mass Communication.