Former state employee Edward Lane’s courtroom testimony in 2008 and 2009 was key to exposing “one of the most egregious public corruption situations in Alabama’s history,” state Attorney General Luther J. Strange III told the Supreme Court on Monday.

“It led to a total rewrite of our public corruption laws and our ethics laws,” he said.

And for his trouble, Lane alleges, he was fired.

In a case important to millions of public employees, the justices considered whether the First Amendment protects Lane from retaliation when he testifies in court about the misconduct he has observed.

What seems like it might be an easy question is complicated, though, when government acts as employer. In previous rulings, the court has said that public employees have free-speech rights when they are acting as citizens, not when they are testifying to what they learned in their jobs or are required to speak about because of their specific duties.

The justices clearly seemed sympathetic to Lane.

Justice Sonia Sotomayor said governments certainly have the ability to restrict employees from talking about subjects in certain forums or disclosing things in an improper way.

But “what kind of message” would the court send by “putting people at risk for . . . telling fundamental truth in a public forum like a trial?”

And Chief Justice John G. Roberts Jr. tried to solicit from Mark T. Waggoner of Birmingham, representing the community college president who let Lane go, whether Lane could have kept his job by lying.

“We would never suggest that anybody not comply with a subpoena, comply with an investigation, or [not] testify truthfully,” Waggoner replied.

“But you are suggesting he can be fired if he does it,” Roberts responded.

Lane is a former employee of Central Alabama Community College, and in 2006 he became director of a program called Community Intensive Training for Youth (CITY). He discovered that a state legislator, Suzanne Schmitz, had arranged a no-show job for herself with the program.

Lane fired her for nonperformance.

After she was terminated, the FBI began investigating and Lane was subpoenaed to testify, first before a grand jury and subsequently at two criminal trials. The first ended in a mistrial, but Schmitz was convicted in the second.

In between the trials, the community college’s then president, Steve Franks, said cuts in the program’s budget required layoffs, and he fired 29 probationary employees with less than three years service. Franks said he then discovered many of the employees were not probationary and hired them back. Lane was one of only two not rehired, and he filed suit.

A district judge ruled against Lane, and the U.S. Court of Appeals for the 11th Circuit agreed that his First Amendment complaint could not go forward because he was not testifying in his role as “citizen.”

Lane’s attorney, Tejinder Singh of Washington, said the court need not add to its precedents about when employees are acting as citizens or testifying pursuant to their duties to rule in Lane’s favor.

Lane “testified about events that he learned while working, but the testimony itself was not a part of his job responsibilities,” Singh said. “This court should hold that petitioner’s testimony implicates the First Amendment because he spoke as a citizen on a matter of public concern.”

Deputy Solicitor General Ian H. Gershengorn, representing the federal government, agreed, as did Strange, Alabama’s attorney general. But Gershengorn said the court should not extend the First Amendment protection too widely.

Governments have a managerial interest, he said, in the “thousands of agents, investigators, technicians and other employees . . . across the government who are expected, as part of their job responsibilities, to testify in court.”

Waggoner said the court should uphold the appeals court’s ruling that while testifying was not part of Lane’s job requirements, “his testimony was inseparable from his job duties, and we do believe that when he testified, that it was pursuant to his official duties.”

But there are problems for Lane even if the court agrees that his speech is protected.

Strange and Waggoner agreed that Franks — and his successor, college President Susan Burrow — cannot be liable for damages. Government officials generally are shielded from civil damages unless it can be shown they violated a clearly established constitutional right.

And 11th Circuit opinions at the time of Lane’s firing, they said, did not make clear that public employees could make First Amendment challenges.

The case is Lane v. Franks.