A federal court has ruled the U.S. State Department cannot deny a passport to a Navy veteran who is intersex and identifies as neither male nor female.

Navy veteran Dana Zzyym, a Colorado resident born in 1958 with ambiguous sex characteristics, sued the federal government for refusing to issue a passport because it requires an applicant to denote either male or female on applications.

Dana Zzyym, of Fort Collins, Colorado, left, and Paul D. Castillo, staff attorney of the South Central regional office of Lambda Legal, leave after a hearing on Zzyym's lawsuit in Denver on July 20, 2016 David Zalubowski / AP file

U.S. District Judge R. Brooke Jackson in Denver ruled the State Department exceeded its authority under the Passport Act of 1926 and barred the department from relying on its binary-only gender marker policy to withhold a passport.

"The authority to issue passports and prescribe rules for the issuance of passports under [the Passport Act] does not include the authority to deny an applicant on grounds pertinent to basic identity," the judge said in the ruling on Wednesday.

Zzyym, who serves as associate director for Intersex Campaign for Equality and sued after being denied a passport to attend a work event in Mexico City in October 2014, cheered the decision.

"It's been nearly four years since the State Department first denied me a critical identity document that I need to do my job," Zzyym said in a statement. "The agency's refusal to issue me a passport has already cost me opportunities in Mexico City."

The State Department did not immediately respond to a request for comment.

The Lambda Legal Defense Fund, which filed the lawsuit on behalf of Zzyym, noted at least 10 other countries issue passports with gender markers other than female or male, most using an "X" gender marker recognized by the International Civil Aviation Organization, which sets travel document standards. Australia, Bangladesh, Canada, Denmark, Germany, India, Malta, Nepal, New Zealand and Pakistan offer a non-binary option.

Zzyym was raised as a boy and underwent several irreversible, painful and medically unnecessary surgeries before joining the U.S. Navy as a male, according to the lawsuit. Zzyym served six years in the Navy and, after returning to civilian life, realized there were others who did not fit into traditional gender categories, according to the lawsuit.

"In light of this ruling, we call on the State Department to promptly issue Dana this essential document that accurately reflects their gender," Lambda Legal Senior Attorney Paul Castillo said, using the gender-neutral pronoun Zzyym prefers.

FOLLOW NBC OUT ON TWITTER, FACEBOOK AND INSTAGRAM