BEIJING — China has taken a step forward to allow same-sex marriage, a move that could undo years of discrimination, delight rights activists and give new rights to the LGBTQ community "after years of hiding and struggling."

A body of the National People's Congress, the country's highest law-making institution, has publicly acknowledged petitions to legalize same-sex marriage, a rare development that has triggered a nationwide discussion of a topic that was once taboo.

Expectations are raised that the nation, which is led by the Communist Party, might eventually join the growing number of countries that have passed legislation protecting the rights of lesbian, gay, bisexual, transgender and queer people.

"We were very happy, pleasantly surprised by the news!" declared Peng Yanzi, director of LGBT Rights Advocacy China.

Since the founding of the People's Republic of China in 1949, homosexuality has been banned or suppressed. However, China's open door policies in the early 1980s set in motion social and cultural changes that would lead Beijing to decriminalize homosexuality in 1997 and remove it from an official list of mental disorders in 2001.

In time, major cities would witness lively gay and lesbian scenes with the proliferation of clubs and bars. But many forms of age-old prejudice and restrictions against the LGBTQ population persist, with activists citing issues ranging from employment discrimination and forced "therapy" to lack of "marriage equality."

Download the NBC News app for breaking news

On Dec. 20, a spokesman was quoted as saying the legislative commission had received more than 230,000 online suggestions and letters on legalizing same-sex marriage. The topic triggered 400 million views on China's Twitter-like Weibo and sparked a lively debate on domestic social media, according to state-run newspapers.

But as recently as August, a representative of the same body had dismissed same-sex marriage as contrary to Chinese culture and stressed that China's marriage system was based on the union of "man and woman."

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

In China, after collecting public opinion, a bill can be drafted and deliberated several times before it is finalized, published again for public comment and submitted to the National People's Congress Standing Committee for enactment.

"It felt unreal," Gao Qianhui, 21, a lesbian in Shenzhen, just across Hong Kong, said when asked about her reaction to the news from the legislative commission, to which she also wrote a petition supporting same-sex marriage.

"I know it's just a proposal and it's most likely not going to be realized in the near future, but the fact this topic is now publicly and officially on the table gives the LGBT community hope for the first time after years of hiding and struggling," she told NBC News.

The apparent change of stance is "a promising and positive step," said Hu Zhijun, director of PFLAG, another advocacy group named after the large LGBTQ rights group in the United States.

The shift even seemed to extend to the cinema — the first gay kiss of the "Star Wars" film franchise recently made it to China's theaters. That followed a few months after scenes of homosexuality in the biopic "Bohemian Rhapsody" were deleted by Chinese censors.

For China's LGBTQ community, the changing government stance reflects a changing climate of opinion due to the "greater open-mindedness" of the Chinese public, especially the younger generation, Hu said.

That China appears to be moving toward liberalizing its stance on LGBTQ issues reflects the "inevitable trend," Peng said. "As the country becomes stronger economically, its civilization must also keep up."

Given the international environment, same-sex marriage legislation "could be used strategically to improve China's human rights reputation," said Timothy Hildebrandt, an associate professor of social policy at the London School of Economics and Political Science who has conducted in-depth research on China's LGBTQ issues.

"But I doubt that, even if passed, the government would put it into human rights terms," he said, as Beijing could be accused of being "cynical" in light of human rights criticism involving Xinjiang and Hong Kong.

"That these conversations are happening at all, and that the government seems open to potentially putting it on the political agenda, are certainly positive steps," he added.

But Peng and Hu are realistic about the long-term campaigns ahead. While official recognition of the issue of same-sex marriage is an improvement, it may take many years before it could become law.

"The important thing is that it's no longer possible for society to stay where it was 10 years ago," Peng said, arguing that the acceptability of gay marriage to the younger generation has "exceeded" the imagination of Chinese officialdom.

While noting that China has its own dynamics and pace, Hu pointed to Taiwan's legalization of same-sex marriage in May, the first such legalization in Asia, as proof that traditional Chinese culture is open to same-sex unions.

For Hu Xingdou, an independent social affairs commentator based in Beijing who is a former economics professor, China's shifting stance reflects the country's greater engagement with the outside world.

"With globalization, China cannot but take into account the changing legal systems in other countries and will try to join the global mainstream," he said.