Lawmakers in Chile on Wednesday passed legislation allowing people as young as 14 to legally change their name and gender identity.
The Chamber of Deputies passed the Gender Identity Law by a vote of 95-46.
It allows people aged 18 and above to change their name and legal gender, while those aged over 14 can do so with the permission of a parent or legal guardian.
The Senate had passed the bill last month, so Wednesday's vote brought an end to a five-year battle in the deeply conservative South American country.
The hotly debated legislation had come close to passing several times, but the issue came to a head earlier this year in the final months of former president Michelle Bachelet's term.
"We are witnessing a historic event which we celebrate with great emotion and joy," said Alvaro Troncoso, head of the Movement for Homosexual Integration and Liberation (Movilh).
"It will improve the quality of life of thousands of people whose dignity and rights have been denigrated simply by the prejudices that exist against their gender identification."
Activists had argued that not allowing people to register legally under the gender they most strongly identified with was a form of discrimination and had caused a variety of social, psychological and legal problems.
"Right now, for the Chilean state, I do not exist," transgender activist Alessia Injoque told AFP shortly before the law was passed.
"Right now there is someone called Alejandro who is not me."
She said the new law would "grant me legal recognition of my existence: recognizing my identity is recognizing a segment of the population that has been ignored and whose identity has been denied."
A survey conducted by Movilh in August of 326 people who identified as transgender revealed that 76 percent of respondents reported having been discriminated against because of their gender identification, limiting their options to find work.
When the new law comes into effect, single people aged 18 or over will be able to legally change their name and gender by filling out a form at the civil registry office, while married people can do so at a family court.
Young adults aged 14 to 18 will need the consent of at least one parent or guardian to change their gender identity at a family court. If they do not have that, they can ask a judge to intervene.
Attempts to apply the law to those under the age of 14 ran afoul of opposition from conservative lawmakers