ALEXANDRIA, Va. (AP) — A federal judge on Friday ordered the U.S. Air Force to temporarily stop discharging service members who are HIV-positive, ruling that it's working under a policy that is "irrational" and "outdated."

U.S. District Judge Leonie M. Brinkema in Alexandria, Va., issued her decision as a lawsuit moves forward against the U.S. military.

Service members in the Air Force claim they're being discharged solely because of their HIV status and despite the recommendations of their doctors and commanding officers, who say they are fit to serve.

For now, the ruling keeps at least two HIV-positive men in the Air Force who were days and weeks away from being formally discharged.

Air Force policies had prevented the service members with HIV from deploying to places outside the United States, such as Iraq and Afghanistan, without a waiver. That, in turn, resulted in the men being considered “unfit” for continued military service.

Because of advances in medicine and treatment for HIV, Brinkema wrote that the disease “does not impose unreasonable burdens on the military when compared to similar chronic conditions.”

She also said that HIV "does not seriously jeopardize the health or safety of the service member or his companions in service."

The judge added that the service members are likely to have some success in arguing their case as it moves forward.

The military has argued that the lawsuit is premature because the personnel have not explored all of their options within the military to fight being discharged. The military has also argued that such policy questions fall under the discretion of the federal government's executive branch.

The Department of Justice is representing the military. Spokeswoman Kelly Laco said its attorneys are reviewing the judge's decision. She declined to comment further.

The service members are being represented by lawyers from the LGBT rights groups Lambda Legal and OutServe-SLDN as well as the law firm Winston & Strawn.

The service members' attorneys said a judge's ruling against the military is rare, and framed the decision as a significant legal victory.

"These decisions should be based on science, not stigma, as today's ruling from the bench demonstrates," said Scott Schoettes, counsel and HIV project director at Lambda Legal.

Schoettes added: “We still have to prove at trial that people living with HIV are deployable. But in the meantime they’re not going to be able to get rid of any of those service members.”