The Supreme Court ruled Wednesday that a former air marshal who was fired after leaking plans to the media about security cutbacks can seek whistleblower protection.

By a 7-2 vote, the justices said Robert MacLean did not violate federal law when he revealed that the Transportation Security Administration planned to save money by cutting back on overnight trips for undercover air marshals.

MacLean leaked the information in 2003 to an MSNBC reporter after supervisors ignored his safety concerns. His disclosure triggered outrage in Congress, and the Department of Homeland Security quickly reversed the policy, calling it a mistake. But the TSA fired McLean three years later after it discovered he was the leaker.

A federal appeals court sided with MacLean, but the Obama administration appealed. The government argued that whistleblower laws contain a major exception — they do not protect employees who reveal information that is "prohibited by law" or by an executive order. Government lawyers pointed to TSA regulations that prohibit employees from disclosing "sensitive security information," including any information relating to air marshal deployments.

Chief Justice John Roberts said in his opinion for the court that nothing in federal law prohibits MacLean from doing what he did. The government has raised legitimate security concerns, Roberts said, but they must be addressed by the president through an executive order or Congress by changing the law. "Although Congress and the president each has the power to address the government's concerns, neither has done so. It is not our role to do so for them," he wrote.

Justices Sonia Sotomayor and Anthony Kennedy dissented.

MacLean also had argued that the information about cutting overnight trips wasn't really sensitive because it had been sent as a text to his cell phone without using more secure methods.

The government warned that allowing MacLean to gain whistleblower status would only encourage other federal employees to divulge secret information, posing a future threat to public safety. Roberts repeated what several justices said during arguments in November — that if the safety issue were grave enough, the president could simply sign an executive order prohibiting federal workers from revealing such sensitive data.

The case is Department of Homeland Security v. MacLean, 13-894.