Three years ago, the Obama administration brought criminal charges under the Espionage Act against Thomas Drake, an Air Force veteran and intelligence expert at the National Security Agency in Maryland.

He was not accused of aiding the enemy or of revealing national secrets. He had, however, helped a Baltimore Sun reporter reveal a billion-dollar boondoggle at the NSA — a computerized data-scanning system that never worked as planned.

The case against Drake collapsed on the eve of his trial when it was revealed that the information was not classified.

But the effort to prosecute an avowed whistle-blower sent a clear message that the Obama administration would zealously prosecute leaks involving national security, even if it meant pushing the margins of the law.

Last week, the Associated Press complained to the Justice Department of a “massive and unprecedented intrusion” into its news-gathering operation. Lawyers who defend whistle-blowers saw the latest incident as part of a pattern. The secret seizure of records for 20 phones lines used by AP reporters surprised even some who had grown used to the administration’s hard line.

“Every president wants to control the message, but this administration has taken things to a different level,” said Kathleen McClellan, a lawyer for the Government Accountability Project, an organization that protects whistle-blowers. “They have indicted a record number of people under the Espionage Act, and they have been very willing to go after journalists.”

Media law experts were surprised at the scale of the seizure. “The scope of this is truly big, unlike anything we had seen before,” said Lucy Dalglish, dean of the journalism school at the University of Maryland.

The government contends that a double agent was indirectly exposed when the AP distributed a story in May 2012 about how the CIA foiled an Al Qaeda plot to sneak a bomb aboard an airline bound for the United States. Atty. Gen. Eric H. Holder Jr. said the leak that led to the story “put the American people at risk — and that is not hyperbole.”

Prosecutors who have worked on leak inquiries say the decision to seize phone records is standard procedure. They also say journalists have no legal immunity to such demands.

“If you are a prosecutor doing a leak investigation, this is a completely legitimate way to proceed. This happens every day in all kinds of investigations. The first thing you do is go to a phone company and get records,” said Washington attorney Peter Zeidenberg, a former federal prosecutor who worked on the leak investigation involving CIA officer Valerie Plame and I. Lewis “Scooter” Libby, chief of staff for Vice President Dick Cheney. “The level of outrage here is not warranted. These are not taped conversations.”

The Supreme Court has drawn a sharp distinction between phone records of incoming or outgoing numbers and the content of phone calls. Prosecutors must obtain a search warrant from a judge if they want to listen to calls, but they can obtain phone records simply by sending a subpoena to a phone company.

The courts have been less clear on whether journalists have any legal protection when they are caught up in a criminal investigation. Most states have shield laws that protect reporters from being forced to testify about what sources have told them, but there is no such federal law. Obama said last week that he would renew efforts to get Congress to pass a federal shield law.

The Supreme Court has rejected the idea that the 1st Amendment protects journalists from ever being called to testify, but many judges have said journalists have a “qualified privilege” to protect confidential sources. In such cases, judges weigh the prosecutor’s need for evidence against the reporter’s need to protect a confidence.

With the phone records in hand, investigators may be able to pinpoint the source of a leak to the AP without seeking testimony from a reporter, Zeidenberg said. “You find the reporters who published the information. Then you find the people who had access to the information. Then, you look at the phone records to see if they communicated with one another. I don’t know how else you would do it,” he said.

The administration has claimed a broad power to prosecute leakers under the Espionage Act, a World War I-era measure that targeted spies and those who aid the enemy. And it has been willing to bypass the protections for journalists that have been followed for decades.

In the past, the Justice Department has relied on internal guidelines, one of which says that in an investigation involving the news media, “negotiations with the affected media member must precede any request” for telephone records, except when doing so would “pose a substantial threat to the investigation.”

This advance notice provision allowed media organizations to object, and if necessary, take the matter to court. Often, judges block or narrow subpoenas for records or testimony if they are not convinced the evidence is necessary for the investigation.

On the other hand, some investigators chafe at the requirement for advance notice because it can delay or even halt their inquiry.

Holder named Ronald C. Machen Jr., the U.S. attorney in Washington, to investigate the AP leak. Without informing the AP management, the prosecutors obtained calling records in April and May of last year. AP’s officials were told of the seizure on May 13 of this year.