BEIJING — Gay rights activists in China sued a counseling center Thursday for its offers to cure homosexuality through “gay conversion therapy” – the first lawsuit of its kind in a country where gay people have few rights and little recognition.

Gay activists staged a protest outside a Beijing court before the case was heard and said they hoped that the trial would persuade the medical community to change its policies on homosexuality and its practice of diagnosing it as a disorder.

Meanwhile, inside the court, a 30-year-old man from southern China said he suffered trauma when a counseling center in the city of Chongqing tried to cure his homosexuality through electric shock therapy and hypnosis. As part of his case, the man also sued Baidu.com, China’s largest search engine company, for false advertising because it ranked the center’s website high in results generated for the search term “homosexual treatment.”

In an interview outside the courthouse, the man asked to be referred to as “Xiao Zhen” instead of using his real name for fear of discrimination among his friends and relatives who don’t know he is gay. He said he has not told his parents about his lawsuit because he hopes to win the case and use it to soften their opposition to his sexuality.

Xiao said that after his parents found out he was gay last year, they refused to accept it. And when they saw an advertisement for gay conversion therapy, they pressured him to seek help at the Chongqing Xinyupiaoxiang Counseling Center in February.

On its website, the center claims to have successfully cured 10 patients in 2011 and seven in the first six months of 2012. It charges $80 per counseling session and $4,860 for a full-course treatment.

Representatives of the center and an attorney for Baidu declined to discuss the case with reporters, leaving the courthouse quickly after the hearing.

The Chongqing center explains its views on homosexuality on its website: “Any type of homosexuality is not really homosexuality. It’s just a wrong way of sexual release. They just need to be guided.”

Homosexuality was deemed a crime in China until 1997 and considered a mental disease until 2001, when it was removed from the Chinese Classification of Mental Disorders.

But the manual still classifies homosexuality and bisexuality as a “sexual orientation disorder,” which gay activists are lobbying to change.