The federal government violated a former Stanford University doctoral student's legal rights nine years ago when it put her on its secretive "no-fly" lists targeting suspected terrorists, a San Francisco federal judge ruled Tuesday.

In a decision for the most part sealed, U.S. District Judge William Alsup disclosed that Rahinah Ibrahim was mistakenly placed on the controversial list and said that the government must now clear up the mistake. The decision comes in a case that has for the first time revealed how the U.S. Department of Homeland Security assembles the no-fly lists, used to tighten security in the aftermath of the Sept. 11, 2001 terrorist attacks.

The Obama administration has vigorously contested the case, the first of its kind to reach trial, warning that it might reveal top-secret information about the anti-terrorism program. As a result, Alsup sealed his ruling until April to give the government an opportunity to persuade a federal appeals court to keep the order from being released publicly.

But Alsup issued a separate three-page ruling outlining the results for Ibrahim, who has waged a high-profile legal battle since she learned she had been placed on the no-fly list as she tried to board a 2005 flight to Hawaii from San Francisco International Airport.

Ibrahim, Alsup wrote, is "entitled by due process to a ... remedy that requires the government to cleanse and/or correct its lists and records of the mistaken information."

Elizabeth Pipkin, Ibrahim's lawyer, said she hopes the ruling will permit the Malaysian national to again be able to travel to the United States.

"She's entitled to have her name cleared from the system," Pipkin said. "She shouldn't be ensnared in their system anymore."

The 48-year-old Ibrahim has been fighting the U.S. government from abroad, denied the right since 2005 to return to this country. Her case went to trial in December before Alsup, who heard the allegations of government wrongdoing without a jury, in part because of the government's assertion of national security privilege.

Ibrahim, an architecture scholar, wearing a traditional Muslim hijab, was arrested at SFO in January 2005 as she headed to a conference in Hawaii with her teen daughter. She had been branded a terrorist suspect in government databases, she learned. Ibrahim denies any connection to terrorist organizations and settled a separate legal case against San Francisco police and others linked to her airport arrest for $225,000.

Before the incident, Ibrahim had been a regular traveler to the United States since the early 1980s, calling it her "second home." She met her husband here, marrying in Seattle in 1986, and her first child is a U.S. citizen.

After returning to Malaysia, she founded the architecture department at a major Malaysian university but returned to the states in 2000 to secure her doctorate from Stanford. As a result of later being put on the no-fly list, Ibrahim had to complete her Stanford doctorate remotely.

But she pressed her legal case for years, even as the government tried to sidetrack the legal claims. The 9th U.S. Circuit Court of Appeals twice allowed her case to proceed over the government's objections, leading to the recent trial.

Justice Department officials could not be reached for comment on Alsup's order.

The government places thousands of people on the lists each year, and similar lawsuits against the program and its methods have been unfolding in other courts around the country, including a major challenge in Oregon brought by the American Civil Liberties Union.

Howard Mintz covers legal affairs. Contact him at 408-286-0236 or follow him at Twitter.com/hmintz