Nicky Scarfo, Jr., son of reputed organized crime boss Nicodemo "Little Nicky" Scarfo, walks through a hallway to court in Philadelphia City Hall, Jan. 24, 1989. Scarfo appeared for a hearing in connection with charges he beat a woman in an elevator at Hahnemann Hospital in Philadelphia while visiting his brother Mark Scarfo. (AP Photo/Charles Krupa)

A little over a decade ago, federal prosecutors used keystroke logging software to steal the encryption password of an alleged New Jersey mobster, Nicodemo Scarfo Jr., so they could get evidence from his computer to be used at his trial.

The technique was classified and FBI technicians warned prosecutors that if the case went to trial, details about the tool could get disclosed in court.

In the end, the judge let the trial go forward without allowing the defense to see details of the technique and Scarfo — the son of legendary Philly mob boss Nicodemo “Little Nicky” Scarfo — was convicted.

But the prospect that classified capabilities could be revealed in a criminal case has meant that the most sophisticated surveillance technologies are not always available to law enforcement because they are classified, current and former officials said.

And sometimes it's not just the tool that is classified, but the existence itself of the capability — the idea that a certain type of communication can be wiretapped — that is secret.

One former senior federal prosecutor said he knew of at least two instances where surveillance tools that the FBI criminal investigators wanted to use "got formally classified in a big hurry" to forestall the risk that the technique would be revealed in a criminal trial. "People on the national security side got incredibly wound up about it," said the former official, who like others interviewed on the issue spoke on condition of anonymity because of the topic’s sensitivity. "The bottom line is: Toys get taken away and put on a very, very high shelf. Only people in the intelligence community can use them."

In fact, because many online communications companies today — those that provide chat, instant message and other services — are not required by law to build intercept solutions into their platforms, the engineers at the FBI and the Drug Enforcement Administration are often tasked with finding ways to help the companies come up with solutions, former officials said.

The DEA in particular was concerned that if it came up with a capability, the National Security Agency or CIA would rush to classify it, said a former Justice Department official.

To adjudicate the issue, the government has a process headed by the attorney general to decide which capabilities should be classified. Law enforcement and intelligence agencies have a seat at the table.

The process involves balancing the risks of disclosure versus the benefit of using the tool, said FBI General Counsel James A. Baker in an interview.

“You make a decision and hopefully it’s the right decision,” he said. “If you use a technique on the law enforcement side, it’s more likely that it will be disclosed publicly and therefore the adversaries will be able to understand what it is that we’re able to do.”

For the most part, the Justice Department frowns upon the intelligence agencies having exclusive access to surveillance techniques, a third former official said. “Main Justice didn’t like the concept of one of their agencies building a capability that another couldn’t utilize,” he said.