Public sector whistleblowers are protected under First Amendment rights from any job retaliation when they raise flags over alleged corruption, the Supreme Court ruled Thursday.

In a unanimous decision, the court decided in favor of Edward Lane, a former Alabama community college official who says he was fired after giving evidence at the criminal fraud trial of a state lawmaker. Lower courts had ruled against Lane, finding that he was testifying as a college employee, not as a citizen.

Writing for the court, Justice Sonia Sotomayor said Lane's testimony was constitutionally protected because he was speaking as a citizen on a matter of public concern — even if it covered facts learned at work.

“Speech by citizens on matters of public concern lies at the heart of the First Amendment,” Sotomayor wrote in the court’s opinion.

“After all, public employees do not renounce their citizenship when they accept employment, and this Court has cautioned time and again that public employers may not condition employment on the relinquishment of constitutional rights.”

Lane was director of a college youth program at Central Alabama Community College in 2006 when he discovered that a state lawmaker, Sue Schmitz, was on the payroll but not showing up for work. Lane fired Schmitz despite warnings that doing so could jeopardize his own job.

Federal prosecutors began investigating Schmitz and Lane was later called to testify before a federal grand jury and under subpoena at Schmitz's two criminal fraud trials. Lane says he was fired in retaliation after testifying at the first trial.

“The First Amendment protects all sworn statements by public employees as part of judicial proceedings—whether compelled by a subpoena or voluntary,” the American Civil Liberties Union wrote in a friend-of-the-court brief supporting Lane.

“Distinguishing voluntary and compelled testimony would disrupt the orderly operation of the American judicial system and deter witnesses from coming forward.”

But the Department of Justice wrote an friend-of-the-court brief partially supporting the opposing view, arguing against the free speech protection for government workers, saying it needs the ability to control its employees.

"Government employers have interests in prohibiting the disclosure of sensitive or confidential information, which may range from tax records and trade secrets to information about law enforcement sources or sensitive investigative techniques," the brief reads, arguing for a balance between the rights of government workers and the government.

Al Jazeera and The Associated Press