DUBAI, UAE, June 19, 2008 -- It took Zainab Rabie three years to become a man as the law would have it.
After a long legal battle, the Arab island country of Bahrain finally recognized Rabie, 34, as a man. Rabie was born an intersexual, with anatomy that is characteristically both male and female.
Rabie was raised as a girl but always sensed there was something wrong with that identity; Rabie never got periods and mixed more easily with boys than with girls in the schoolyard.
Rabie got married at age 25. But after the wedding, when they were ready to consummate their union, Rabie's new husband was shocked by what he discovered.
"I actually found out on my wedding night and my husband took me to several hospitals where they ran checks on me and declared that I was actually a man," Rabie told Bahrain's Gulf Daily News.
The couple separated soon after the wedding. Rabie flew to Thailand for a sex change operation and began a three-year legal fight to be recognized as a man. That battle ended Wednesday, when Bahrain's High Civil Court changed Rabie's legal identity from female to male.
"People around me always treated me like a female, but I always felt otherwise. I used to wear the abaya and the hijab before the court case," Rabie said of the traditional black robe and veil worn by women in Gulf Arab countries.
"I'm so happy and relieved that they ruled in my favor because this has been a long journey, and it's finally over," he said to Gulf Daily News.
Rabie is not the first intersexual to win a court case in Bahrain; there was a similar case in 2005. But in a region where homosexuality is illegal and gender identities rigid, intersexuals have a hard fight. In Gulf Arab countries, gays and lesbians keep a low profile, otherwise risking legal or social censure.
"It's very difficult in the Gulf," Rabie's lawyer, Fouzia Janahi, told ABC News. "Islam rules that we're not allowed to change our sex, but they have a problem; they have both sexes."
Janahi said that the Bahraini courts needed medical documentation proving Rabie wasn't a woman before approving the sex change on paper.
Janahi represents cases in Qatar, Kuwait, Saudi Arabia and Abu Dhabi, each place with different rules for gender reassignment. In Saudi Arabia, the law dictates that authorities must issue a fatwa, or religious ruling, to allow the switch.
In all cases, Janahi's clients had to leave the country to find sex change surgery; she says. Thailand is the preferred destination, because procedures there are relatively inexpensive. The Bahraini government provided a subsidy of 5,000 dinars (roughly $13,300) to cover the cost of Rabie's travel and surgery.
The situation is vastly different throughout the Persian Gulf. In the Islamic Republic of Iran, homosexuality is illegal, but sex change operations are easy to get and, in some cases, subsidized by the state.
"Iran is different," Janahi said. "It's easy there."
Sex change operations have been permitted in Iran since Ayatollah Ruhollah Khomeini used the Shiite jurisprudence process called "Ijtihad" to rule 25 years ago that the procedure counts as corrective surgery. The supreme leader and spiritual guide of the Iranian Revolution recognized intersexuals as a third category -- neither man nor woman.
Bahrain's decision means a new life for Rabie, who plans to change his name from the feminine "Zainab" to the masculine "Hussein" as soon as the lower court reconvenes after summer break.
But the outcome doesn't necessarily mean more rights for gays or intersexuals in the Middle East.
"It's a big step, and yet it's not," said Pervez Sharma, director of "Jihad for Love," a new film that follows gays and lesbians in the Muslim world.
"Often it becomes the only way for a person to be gay or lesbian -- by getting a sex change."