Vietnam has passed a landmark law enshrining the rights of transgender people which advocacy group says will now pave the way for gender reassignment surgery in the country. Such operations are currently illegal in the communist state.

Transgenders currently travel to Thailand for such surgeries. Under the new law, those who have undergone gender reassignment can register themselves under their new sex. The law takes effect from early 2017.

A total of 282 lawmakers out of the total 366 voted in favour of the new law. "Individuals who undergo transgender change will have the right to register" under the new gender with "personal rights in accordance with their new sex," reported the state-controlled VNExpress website. It cited a National Assembly report.

The law aims to "meet the demands of a part of society ... in accordance with international practice, without countering the nation's traditions," the report from the Vietnamese parliament said. The new law was welcomed by the country's lesbian, gay, bisexual and transgender (LBGT) community.

"Now people accept there is a transgender community, their legitimate rights will be ensured," said Nguyen Hai Yen from ICS, a local LGBT organisation. ICS estimates there are around 270,000 transgenders in Vietnam.

"People will no longer have to travel abroad for transgender surgery," said Luong The Huy, LGBT manager at Vietnam's Institute for Studies of Society, Economy and Environment. The Vietnamese authorities seem to be adopting a more progressive view in its approach to sexuality.

Homosexuality, although still a taboo subject, is not illegal in Vietnam. In 2013, the government abolished fines for same-sex wedding parties which are symbolic unions that do not have full legal recognition. LGBT groups are still lobbying for the authorities to legalise same-sex marriages.