GUATEMALA CITY (AP) — Alex Castillo knew growing up that he was a boy trapped in a girl’s body. It wasn’t until recently, 40 years after his birth, that the government of his native Guatemala — or at least some parts of it — agreed.

Castillo, who recounted the humiliation of being groped by border guards unable to square his masculine appearance with the female name on his identity card, has finally been able to legally change it. Life as a transgender person is still a daily battle, but today it’s a bit easier thanks to the state-sanctioned ID that matches his male identity.

“I had to change my name legally, for work reasons, because I handle money,” said Castillo, who has not undergone gender-reassignment surgery. “Going to the bank with my physical appearance and my (previous) identity document was always very traumatic.”

Both government and society have long had little tolerance for sexual diversity in this Central American nation. But Guatemala’s LGBTQ community has quietly been winning small battles for acceptance. They may seem small compared with other nations, but were virtually unthinkable here until very recently.

In the last year, the prosecutor’s office has updated its computer systems to include a box where people can choose their gender identity, in particular to help identify and track hate crimes. Carlos Romero, director of the LGBTQ umbrella group Redmas, said the institution now recognizes not only people’s birth names but also social names by which they identify.

Meanwhile, the National Population Registry has also modified its policies to acknowledge transgender identities and trained workers to receive people — and to do so respectfully — regardless of whether their appearance corresponds to the gender listed on their birth certificates.

“We have stories of people who were forced to take off their makeup, to hide their hair, so that they had the image that a bureaucrat thought they should have,” Romero said. “Before, they made me take off my earrings because they weren’t masculine.”

The changes took place quietly beginning in 2014, when the Human Rights Prosecutor’s Office set up a Sexual Diversity Defense branch, the country’s first official entity dedicated to protecting the rights of lesbian, gay, bisexual, trans and queer people. Activists say the reforms were the result of grass-roots lobbying aimed at specific institutions instead of trying to push laws in Congress. Groups are also holding sensitivity training sessions with police officers.

But with no official announcements or media attention, the gains were almost entirely unknown until some people began talking about them in recent months. Most Guatemalans are unaware, and there has been no pushback so far from the Roman Catholic Church or other conservative sectors.

They have been mirrored by other steps toward broader LGBTQ acceptance: In January, Sandra Moran became the first openly gay person to take a seat in Congress. Her agenda includes sexual diversity measures, human rights and women’s and children’s issues.

Romero said a next step will be to seek a law protecting sexual orientation and gender identity covering education, work and security.

Activists in equally conservative neighboring countries are looking at what’s happened here as a model.

“The battles that the LGBTQ community has won in Guatemala are pretty significant achievements and could be an example for other nations in Central America,” said Carlos Valdez, president of a network that pushes for gay acceptance in the region.

He noted that Honduras and El Salvador do not have protections such as those won in Guatemala. Groups in the two countries are lobbying for a gender identity law, however.

“Guatemala has advanced quite a bit,” said Gabri Mass, a Honduran activist. “Comparing their achievements, we could say that Guatemala has made a 100 percent advance and Honduras just 45 percent. In Honduras there is a lot of intolerance for sexual diversity.”

El Salvador’s Labor Ministry has assigned staffers to help LGBTQ people find work, although there has been no sign of institutions moving to specifically change policies on gender identity.

LGBTQ communities have won significant gains in some other parts of Latin America and the Caribbean in recent years, although activists say discrimination persists.

Argentina became the first country in the region to legalize gay marriage, in 2010, also conferring adoption rights on same-sex couples. Uruguay and Brazil followed suit in 2013. It’s also legal in several states in Mexico, where a 2015 ruling also made it easier for gay and lesbian couples to marry nationwide even without specific laws in many places.

Bolivia passed a bill in May letting people change their names and gender on IDs despite opposition from the Catholic Church. Cuba’s free health care system now covers gender-reassignment surgery. And Chile approved a law last year guaranteeing civil unions for both gay and straight couples.

Guatemala still has a ways to go to catch up to those countries. The Inter-American Commission on Human Rights recently noted the advances in institutional recognition of transgender people there, but also warned of ongoing, serious “violence and discriminations against lesbian, gay, bisexual and trans people.”

For Castillo, the administrative and financial director for the Lambda Association rights group, the toughest thing is the rejection he feels from his two children from a previous marriage and from other family members.

“If your own people who are your blood don’t accept you,” Castillo said, “what can you expect from someone who doesn’t have the least amount of empathy?”

© 2016, Associated Press, All Rights Reserved.

This material may not be published, broadcast, rewritten, or redistributed.