Browsing the internet as a young policeman in China, Ma Baoli recalls the sheer volume of web pages telling him he was a pervert, diseased and in need of treatment -- simply because he was gay.

"I felt extremely lonely after I became aware of my sexual orientation," says Ma, at the time a newly minted officer in a small coastal city.

Two decades later, the softly spoken 43-year-old now helms Blued, one of the world's largest dating platforms for gay men.

The app went public last July with an $85 million debut on Nasdaq, a remarkable tech success story from a country that classified homosexuality as a mental illness as recently as 2001.

Ma Baoli helms Blued, China's largest dating app for gay men
Ma Baoli helms Blued, China's largest dating app for gay men AFP / NOEL CELIS

Parent company BlueCity's sunlit Beijing campus teems with young and casually dressed programmers who hold meetings in rooms named after Oscar Wilde and other prominent LGBTQ figures from around the world.

The office boasts rainbow unicorn mascots, gender-neutral toilets and photos of Ma's meetings with dignitaries, including Chinese premier Li Keqiang.

Ma's journey to the apex of China's tech industry began in the early 2000s when he began publishing Danlan.org, a blog about his life as a gay man.

Blued parent company BlueCity's sunlit Beijing campus teems with young programmers who hold meetings in rooms named after Oscar Wilde and other prominent LGBTQ figures
Blued parent company BlueCity's sunlit Beijing campus teems with young programmers who hold meetings in rooms named after Oscar Wilde and other prominent LGBTQ figures AFP / NOEL CELIS

There were few places in China at the time for gay men to socialise, Ma says, adding that "people would write on the walls of public toilets, saying meet here at this and that time."

"Everyone was scared of being found out by others."

Ma's blog gradually expanded into an influential online forum for LGBTQ people in China to share lifestyle articles, health advice and short stories.

"I thought I could build a website, to tell gay people like me... you don't need to feel inferior, you don't need to be suicidal," he told AFP.

The firm's office boasts rainbow unicorn mascots, gender-neutral toilets and photos of Ma Baoli's meetings with dignitaries
The firm's office boasts rainbow unicorn mascots, gender-neutral toilets and photos of Ma Baoli's meetings with dignitaries AFP / NOEL CELIS

Increasing local media coverage of the website outed Ma to his coworkers and prompted him to leave the police force in 2012.

He launched Blued the same year.

The app today says it has more than 58 million users in China and countries including India, Korea and Thailand.

It has yet to turn a profit but company figures show losses have narrowed since the platform began paid memberships, livestreams and ads in 2016.

Like other dating apps, many Blued users are seeking hookups and casual dates.

Ma Baoli (R) believes his work has helped improve the mainstream perception of LGBTQ people in China, including friends and family who previously shunned him
Ma Baoli (R) believes his work has helped improve the mainstream perception of LGBTQ people in China, including friends and family who previously shunned him AFP / NOEL CELIS

But Ma also keeps a stack of letters on his desk from users who have written to thank him for helping connect them to their long-term partners.

Discussion of LGBT issues remains contentious in China, with activists complaining of tightened restrictions on public discussion in recent years.

But despite Danlan.org being repeatedly shut down in the first few years of its existence, Blued has largely avoided conflict with authorities.

It has opted for a cautious approach in raising mainstream awareness and tolerance of the LGBTQ community.

That includes its efforts to tackle the stigma around HIV that has fuelled discrimination against gay men and prevented people from seeking medical care.

BlueCity runs an online platform that sells HIV diagnostic kits and brokers consultations with doctors. It also works with local authorities to direct users to free testing centres.

Ma said he was pleasantly surprised by at the response he received after sounding out health officials to cooperate on HIV prevention campaigns.

"They said they had really wanted to reach the gay community," Ma told AFP, "but they didn't have the channels and didn't know how to find them."

Still, the platform has suffered its share of teething problems.

It temporarily froze new user registrations in 2019 after local media reported that underaged boys had been using the app, and the company pledged to tighten age and content controls.

Ma says his team are committed to "building a brighter and healthier image of the community".

He believes his work has helped improve the mainstream perception of LGBTQ people in China, including friends and family who previously shunned him.

And he thinks more positive recognition is on the horizon.

"I think there will eventually be a day when gay marriage is legal in China," he says. "It's only a matter of time."