Image copyright AP Image caption Supporters cheered the Sun Wenlin and Hu Mingliang as they arrived at Furong District People's Court

A judge in China has ruled a gay couple cannot register as married, in the country's first case of its kind.

Sun Wenlin and Hu Mingliang filed a lawsuit against Changsha city authorities after their application to register a union was rejected.

In January a district court agreed to hear the case, a first in China.

China does not legally recognise same-sex marriage but there is growing awareness of lesbian, gay, bisexual and transgender issues.

On Wednesday, there were cheers for Mr Sun, 27, and Mr Hu, 37, when they entered the court, from hundreds of supporters who had gathered outside. Authorities allowed about 100 of them inside.

The court dismissed the case a few hours after the hearing started.

Image copyright Associated Press Image caption About 300 people came to the courthouse to show their support for the couple

Image copyright EPA Image caption Mr Sun said police had visited him to try to persuade him to drop the case

Why activists see hope - Celia Hatton, BBC News

The entire case was argued and decided within a few short hours, and the judge was quick to reject China's first legal argument in favour of gay marriage. But many gay rights activists see reason for hope.

The fact the case was heard at all was reason for optimism - the plaintiffs and their lawyer were surprised when the Hunan court agreed to hold a hearing in January. The hearing itself was held in an unusually large courtroom, with uncharacteristically light security outside.

Few believe the Chinese courts are poised to issue dramatic decisions permitting same-sex marriage. But bit by bit, some cases are being won. In December 2014, a Beijing court awarded damages to a man who had suffered electric shock therapy meant to "cure" his homosexuality. Advertisements for the service were ordered to be removed from the internet.

The demand for gay rights is certainly part of the national conversation now in China. Just last week a mass social media campaign in which gay people pledged not to yield to pressure to marry straight people attracted more than 1.5 million views on Weibo.

China's legal courts are moving slowly, but the court of public opinion is still in session.

The couple's lawyer, Shi Funong, said he had expected the judgement to go against them but not so quickly.

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

Mr Sun said he would appeal against Wednesday's court decision.

The two men had tried to register their union in June last year and filed the lawsuit in December.

Mr Sun said police had visited him after he filed the case to try to persuade him to drop it, but he refused.

"The original text of the Marriage Law does not say one man and one woman, but a husband and a wife," he said in an interview with state media in January. "I personally believe that this term refers not only to heterosexual couples but also to same-sex couples."