The policy, the court ruled, is obsolete.

"A ban on deployment may have been justified at a time when HIV treatment was less effective at managing the virus and reducing transmission risks," a three-judge panel of the 4th US Circuit Court of Appeals wrote.

"But any understanding of HIV that could justify this ban is outmoded and at odds with current science," the ruling continues. "Such obsolete understandings cannot justify a ban, even under a deferential standard of review and even according appropriate deference to the military's professional judgments."

"I am extremely relieved to learn that I can continue to serve this country like any other service member," one of the two airmen said in a statement under the pseudonym "Victor Voe."

"Serving in the U.S. military has been the greatest honor of my life and I'm thrilled to see this court affirm the lower court ruling in our favor," he added. "No one should be discharged or discriminated against because of HIV when it does not interfere whatsoever with our capacity to serve."

Lynn Kirby, an Air Force spokesperson, told CNN, "We have received and respect the court's ruling and are committed to treating all Airmen fairly under the law. However, due to ongoing litigation we cannot provide further comment on this particular case."

The lawsuit, filed by the two airmen under the pseudonyms Voe and "Richard Roe" in December 2018, claimed that the Pentagon was discriminating against service members with HIV through a long-standing Defense Department rule that says they can't deploy outside the US without a waiver.

The Trump administration introduced a new rule in February 2018 that said any service member who can't be deployed outside the United States for more than one continuous year should be separated from service. Proponents of the policy said it reduced the burden on deployable service members, who were deploying at higher rates due to the need to cover for those service personnel who are not deployable.

"This directive arguably would have applied to almost all service members living with HIV," the airmen's lawsuit said.

Roe and Voe argued that they faced "being discharged despite the contrary recommendations of their commanding officers and physicians solely because they have tested positive" for HIV -- despite adhering to treatment plans and not showing symptoms.

Air Force spokesperson Ann Stefanek pushed back on the allegations when the airmen filed the lawsuit, stating that "the Air Force does not find all airmen with asymptomatic HIV unfit" and that each chronically ill Air Force member's "fitness determination is conducted on a case by case basis."

Scott Schoettes, a lawyer for the airmen and HIV Project Director at Lambda Legal, was confident that the case would ultimately be successful when it went to trial as the airmen remained in the Air Force "because the Government is unable to offer a reasonable justification for their discriminatory treatment of service members living with HIV."

"At the root of these discharge decisions and other restrictions on the service of people living with HIV are completely outdated and bigoted ideas about HIV," he said in a statement Friday. "Today's ruling clears the way for us to definitively prove at trial that a person living with HIV can perform the job of soldier or airman as well and as safely as anyone else."