Beatie, 40, was born female, but in 1997, he began testing to determine his psychological gender and in 2002 underwent the first of his gender-reassignment surgeries. Under Hawaiian law, he was able to have his birth certificate amended and legally be recognized as male. Subsequently he married.

Because his wife was unable to conceive children, and because Beatie still had female reproductive organs, he was artificially inseminated and became pregnant.

Then he hit the talk-show and tabloid circuit as "The Pregnant Man," posing with his manly beard and chest and his very pregnant belly. He gave birth to his first child in 2008 and had two more by 2011.

By then, he and his wife had moved to Arizona. When their marriage fell apart, and Beatie wanted to marry another woman, they petitioned for an uncontested divorce.

But in March 2013, Maricopa County Superior Court Judge Douglas Gerlach ruled that Beatie's marriage was between two females because Beatie had given birth. Same-sex marriage is illegal in Arizona.

In one of his rulings, Gerlach wrote that Beatie's "marriage was between a female ... and a person capable of giving birth, who later did so."

Wednesday's ruling, however, noted that Arizona law also permits people who have had gender reassignment to alter their birth certificates and legally change gender. In fact, according to the opinion, Arizona's law on the matter is more "liberal" than Hawaii's in what evidence must be presented to amend the birth certificate.

"The question before this Court is not whether the State of Arizona allows same-sex marriage or divorce, but whether the laws of the State of Arizona allow a marriage, lawfully entered into in another state, between two persons the foreign state formally recognized at the time of the marriage as male and female, to be dissolved," the appellate decision said.

"At the time of the Beaties' marriage in Hawaii, that state only allowed marriages between a man and a woman, and Hawaii's legislature, like Arizona's, had established statutory authority allowing persons who had undergone a sex change operation to apply for and obtain an amended birth certificate reflecting the appropriate gender."

Beatie and his wife may go ahead with divorce proceedings, according to the opinion.

In a statement released by his attorney, David Michael Cantor, Beatie was quoted as saying, "I feel I have finally been recognized in Arizona as not just a man, but a human being."