(CNN) -- A federal judge has ordered the reinstatement of an openly lesbian former Air Force major who was dismissed from the military under the government's "don't ask, don't tell" policy.

Judge Ronald Leighton of Tacoma, Washington, made his ruling Friday. It is the latest legal and political setback for the Obama administration, which is seeking to end the policy through a legislative and executive solution.

Maj. Margaret Witt, a decorated flight nurse with 20 years of service, had sued to return to the Air Force Reserve. She was honorably discharged in July 2007 on the grounds that she had a six-year relationship with another woman, a civilian.

"Her discharge from the Air Force Reserves violated her substantive due process rights under the Fifth Amendment to the United States Constitution. She should be restored to her position as a flight nurse with the 446th AES as soon as is practicable," wrote the judge.

An Air Force spokesman said the Air Force believes that "Major Witt's discharge was fully consistent with the law and thus appropriate."

"While we are disappointed the district court judge did not agree that important Congressionally-recognized military interests were furthered by Major Witt's discharge, we are pleased he allowed the government to develop a more detailed factual record for the appellate courts to consider," said Lt. Col. Todd Vician.

The "don't ask, don't tell" policy enacted in 1993 prevents gay men and lesbians from openly serving in the military and bars officials from inquiring into a service member's sexuality.

The Senate this week temporarily turned aside legislation to repeal the law.

Witt joined the Air Force in 1987 and was suspended in 2004, after her superiors discovered her personal relationship with the civilian woman. At the time, she worked for an air-medical transport unit that evacuated and treated wounded soldiers.

She was described in employee reports and by trial witnesses as an "exemplary officer" who was an effective leader, caring mentor, and skilled clinician. She had hid her homosexuality for years.

The judge found no compelling reason for her dismissal.

"The application of 'don't ask, don't tell' to Major Margaret Witt does not significantly further the government's interest in promoting military readiness, unit morale and cohesion," he wrote.

In 2006, Leighton had ruled against Witt, but a federal appeals court had ordered him to take another look at the case.

A six-day federal trial had wrapped up earlier this week, and Leighton had openly indicated he would likely rule in Witt's favor.

"My colleagues -- my friends -- said, 'Ron, you got it wrong,"' Leighton said near the end of the trial, referring to his earlier decision. "They told me what I needed to do, what I needed to ask."

The judge is a 2002 Bush appointee.

Witt's lawyers from the ACLU argued that the Spokane native's sexuality never led to any problems within her unit. Several members of her squadron had testified they would welcome her back.

"Today we heard the hammer of justice strike for Major Margaret Witt," said ACLU of Washington Executive Director Kathleen Taylor. "We look forward to the day when all members of our military can serve our country without invidious discrimination. To discharge her simply because of her sexual orientation was entirely unfair to her and unwise for the military, which needs her significant skills."

Witt was released just before she was set to retire with full benefits. The judge rejected a separate argument from Witt that her procedural due process rights were violated. Leighton said the Air Force gave her full notice of the charges against her and she was given the opportunity to challenge the charges.

Air Force lawyers argued the military -- not the courts -- was in the best position to evaluate and enforce the "don't ask, don't tell" policy. A federal judge in California earlier this month had similarly ruled the policy unconstitutional. That judge will soon rule on whether the Pentagon will be barred from enforcing it.

President Barack Obama is pushing for a repeal of the controversial policy. A bill that would overturn the measure after a Pentagon review is completed in December is currently before Congress.

More than 12,500 gays have been booted from the military since "don't ask, don't tell" went into effect.