Robert MacLean, seen in this Sept. 9, 2014 photo, was fired by the Transportation Security Administration in 2006 after the agency discovered that he had leaked information years earlier to a reporter. (House Committee on Oversight and Government Reform)

The Supreme Court on Wednesday ruled that an air marshal fired for leaking information about plans that he felt endangered the public could seek protection under a federal law protecting whistleblowers.

The court ruled 7 to 2 that Robert J. MacLean did not technically violate the law when he leaked to a reporter that the Transportation Security Administration (TSA) planned to cut back on overnight trips for undercover marshals.

The news caused an uproar in Congress, and the plans were quickly scuttled. MacLean was fired years later when it was discovered he was the source of the information.

While Chief Justice John G. Roberts Jr. wrote for the majority that the Merit Systems Protection Board was wrong to say MacLean was not protected by whistleblower protection statutes, he also said it would be easy for the government to remedy that in future cases.

Roberts said the government had “legitimate” concerns that finding for MacLean “would make the confidentiality of sensitive security information depend on the idiosyncratic judgment of each of the TSA’s 60,000 employees.”

But he added “Congress and the president each has the power to address the government’s concerns [and] neither has done so. It is not our role to do so for them.”

Roberts said Congress could change the law. And he said the president “could prohibit the disclosure of sensitive security information” by executive order.

MacLean contends that just after being briefed in 2003 about a potential terrorist attack, he received another TSA message: Because of a budget shortfall, the agency was cutting back on the number of flights marshals could cover.

MacLean said he went to his boss, who told him to keep quiet, and to the department’s inspector general. Stymied, he leaked the information to a reporter for MSNBC.

His identity was discovered years later, and he was fired for disclosing what is known as “sensitive security information,” or SSI.

The U.S. Court of Appeals for the Federal Circuit, though, said MacLean was entitled to argue that he was protected by the federal Whistleblower Protection Act.

The case turned on a technical point in the law. The Whistleblower Protection Act shields employees who disclose information that they reasonably believe exposes a “substantial and specific danger to public health or safety.”

But the leaks are protected only “if such disclosure is not specifically prohibited by law.”

The appeals court found that the Aviation and Transportation Security Act provided only general guidance about disclosing information, not a specific prohibition. The TSA regulations prohibiting disclosure of SSI did not qualify as a “law,” the appeals court ruled, and the Supreme Court agreed.

Justice Sonia Sotomayor dissented, and Justice Anthony M. Kennedy joined her.

Sotomayor said Congress was simply leaving the specifics of what information should not be disclosed up to the agency.

“Congress cannot be expected to identify with particularity each individual document or datum the release of which it wants to preclude,” she wrote.

But she said the impact of the decision could be limited.

The court “would appear to have enabled future courts and Congresses to avoid easily the consequences of its ruling, and thus to have limited much of the potential for adverse practical effects beyond this case,” Sotomayor wrote.

“But in the interim, at least, the Court has left important decisions regarding the disclosure of critical information completely to the whims of individual employees.”

The case is Department of Homeland Security v. MacLean.