A judge in China has ruled against a gay couple seeking to marry, the first same-sex marriage case in the conservative Communist country.

China doesn't recognize gay marriage, and the couple brought the lawsuit after their application for a marriage license was denied last summer. The two men, Sun Wenlin and Hu Mingliang, filed their suit in December against the Changsha civil affairs bureau in the southern province of Hunan.

Surprising many, the court agreed to hear the landmark case earlier this year. But after postponing the hearing once, it ruled against the couple within several hours of Wednesday morning's hearing.

"The relevant regulations and law clearly stated the subject of marriage refers to a man and a woman who meet the legal conditions of marriage," the court said in a statement . "Sun Wenlin and Hu Mingliang are both men, therefore their application doesn't comply with the marriage regulations and law. The grounds of Sun Wenlin's and Hu Mingliang's appeal cannot be established. In summary, the court dismissed their litigation requests according to the law."

The couple's lawyer, Shi Funong, said he expected such a ruling, but not so quickly, the BBC reported.

"It goes against the spirit of the laws of the People's Republic of China," Funong said.

Sun and Hu plan to appeal the ruling, which they must do within 15 days according to Chinese law. They argue that the fact that some statutes refer to marriage as being between a man and a woman is not enough to deny their right to marry.

"But the fact that marriage between a man and a woman is legal does not suggest that marriage between two men is illegal," Sun said. "This is illogical. I asked them to name one article that explicitly bans marriage between two men, but they never answered my question directly."

The case has become a rallying cry for gay, lesbian, bisexual and transgender people in China. Talking about same-sex marriage has long been taboo, and homosexuality was classified as a mental illness as recently as 2001. Several hundred people gathered outside the courtroom in support of the couple as the hearing was taking place.