Former Stanford graduate student Rahinah Ibrahim was mistakenly placed on the government’s “no-fly” list, as a suspected terrorist, because an FBI agent checked the wrong box on a form in 2004.

That news comes from U.S. District Judge William Alsup of San Francisco, who presided over a trial on Ibrahim’s suit to clear her name and allow her to fly to the United States, which has barred her from returning for nine years. She’s now a professor and dean of a college of design and architecture in her native Malaysia.

Much of the trial, the first ever involving a challenge to the no-fly list, was held behind closed doors because of the government’s insistence on secrecy. Last month Alsup issued a brief summary of his ruling, which found that the government had violated Ibrahim’s rights, has admitted that she poses no threat to national security and must allow her to apply for re-entry to the U.S. But he didn’t order her readmitted and said such decisions are within the government’s discretion.

On Thursday, Alsup released his actual 38-page ruling, or at least as much of it as the Obama administration agrees can be made public. The judge said it contains no state secrets and should all be disclosed, but he’s given the Justice Department until April 15 to persuade an appeals court to maintain the partial blackout.

The ruling shed some new light on Ibrahim’s arrest and two-hour detention in January 2005 at San Francisco International Airport, where she had gone with her 14-year-old daughter for a flight to Malaysia. She was told she was on a terrorist watch-list, then was told it had been a mistake and she was cleared to fly. When she tried to return from Malaysia two months later, she was told that her student visa had been revoked under a terrorism law. She’s still without a visa or an explanation.

Alsup said the reason for the initial mistake was that FBI agent Kevin Kelly, who was investigating Ibrahim for reasons the government won’t disclose, had “misunderstood the directions” on a government form and “checked the wrong boxes” — ignoring written instructions that she should not be placed on the no-fly list. Alsup didn’t say what boxes Kelly was supposed to check or why.

“This was no minor human error but an error with palpable impact, leading to the humiliation, cuffing, and incarceration of an innocent and incapacitated air traveler,” Alsup said, noting that Ibrahim was then using a wheelchair after undergoing surgery. “Whether true or not, she reasonably suspects that (her current travel restrictions) are traceable to the original wrong that placed her on the no-fly list.”

The judge said the U.S. government must clear up Ibrahim’s records and tell her whether she is back on the terrorist watch-list — information that he blacked out of his public ruling while dropping a few hints (for example, describing the government’s concession that Ibrahim “poses no threat to air safety or national security and should never have been placed on the no-fly list”). He also cited the government’s own admissions, in public audits, that its watch lists have been full of errors and misidentifications. But he said the government still has the authority to deny a visa to Ibrahim, after reviewing her forthcoming application, and there’s not much that the courts could do about it.

Ibrahim’s lawyer, Elizabeth Pipkin, said Alsup’s redacted ruling is a testimonial to the excesses of government secrecy. When Kelly, the erring FBI agent, testified at the trial, she said, the public was excluded, at the Justice Department’s insistence, “and it was all to hide a mistake.”

“They did not give any evidence in this case that their (watch-list) system has prevented one terrorist attack or saved any American lives,” Pipkin said. “They did not justify why they’re putting innocent people on a secret blacklist. …If they think this program is so important, they should be able to justify it and speak about it in public.”