SANTIAGO, Chile (AP) — Monica Flores was returning from a holiday abroad when Chilean police stopped her for questions at the airport. They were bothered that their records didn't match: She had left the country with a son and returned with a daughter.

Flores had to explain that her 6-year-old registered as a boy identifies as a girl.

In this July 18, 2017 photo, transgender girl Luna plays with her dog Stark on her Barbie-themed bedspread at her home in Santiago, Chile. Last year a judge ordered officials at the civil registry to change the child’s name and gender on her birth certificate, a landmark decision and a first for someone so young in Chile. (AP Photo/Esteban Felix)

"It was a distressing moment. I realized that it was urgent that the different institutions of our country could be trained about trans issues to avoid having children undergo these questionings," Flores said.

The uncomfortable incident two years ago, led Flores and her ex-husband to launch a legal battle for the rights of their daughter — a struggle that has encouraged the families of other trans children to demand greater acceptance and that has fed the broader debate about gender rights in a country so socially conservative that it legalized divorce just 13 years ago.

In this July 18, 2017 photo, transgender girl Luna sits beside the pool at her home in Santiago, Chile. An uncomfortable incident two years ago about Luna's gender led her parents to file a lawsuit demanding her name and gender be legally changed from boy to girl on her birth certificate. (AP Photo/Esteban Felix)

The family's efforts led to a landmark decision last year when a judge ordered officials at the civil registry to change the child's name and gender on her birth certificate — a first for someone so young in Chile.

"This girl's case touched my heart. I couldn't allow her to continue living in the wrong body before society," Judge Luis Fernandez, who ruled in favor of the child, told the newspaper La Tercera in the only interview that he has granted about the case.

Fernandez's ruling so outraged conservative groups that they filed a criminal complaint against the judge. It was thrown out.

At least five other, similar requests for gender registration changes have been filed for minors since Fernandez's decision.

In this July 1, 2017 photo, Angela, below center, places a crown of flowers on her head as she attends a Gay Pride march alongside other transgender children in Santiago, Chile. The transgender children at the parade had socially transitioned to their chosen gender with the backing of their families. (AP Photo/Esteban Felix)

The center-left government itself has been pushing an array of measures for gender rights, ranging from decriminalizing some abortions under legislation upheld Monday by the Constitutional Court to demanding greater acceptance for transgender people in general and children in particular.

The Education Ministry issued a directive in May urging schools nationwide to protect the sexual orientation and gender identity of student. The anti-bullying measure urges schools to identify the trans children by their preferred gender. The country's Catholic schools association has promised to resist the measure.

More broadly, the government is backing a bill that would give adults the right to change the official records of their gender, though the measure has stalled in Congress, facing challenges from the Roman Catholic church and other traditional forces.

Even with the measure still in limbo, a Santiago appellate court in June accepted a transgender adult's right to change the registry. It said "every person has the right to the free development of their personality in accordance with their own determination of gender."

In this Aug. 15, 2017 photo, transgender boy Valentin, 16, is embraced by his father Juan Carlos at a park in Santiago, Chile. Valentin and his father were at the park for a workshop that focused on gender and empowerment. (AP Photo/Esteban Felix)

The bill before congress initially would have covered children like Flores' daughter, though that was stripped out of the bill after meeting even stiffer resistance. Some doubts came from Chile's association of endocrinologists, which expressed support for letting adults make such legal changes, but said it was premature to do so in childhood, when the body and brain are still developing and when gender identity can sometimes shift with puberty.

Chile in 2012 adopted a law to bar discrimination and hate crimes following the beating death of a gay youth that shocked the country. And in 2015 it recognized civil unions for same-sex couples.

Nearly all of those moves have been met with resistance from conservative lawmakers and Catholic leaders who argue that such moves undermine families and society.

In this July 18, 2017 photo, a rhinestoned crown sits on a sofa in Luna's home in Santiago, Chile. Soon after Luna learned how to talk, she asked her mother why she had named her like a boy, if she wanted to be a girl. A judge ruled in favor of legally changing her name to match her chosen gender. (AP Photo/Esteban Felix)

Flores' daughter — she asked that the girl be called Luna — is still too young to worry about details of the debate.

On a recent day, she fixed a green scarf over her silky black hair and wore a flowered skirt over fuchsia tight pants and a dark vest. She always wanted to be a princess or a fairy when she chose cartoon characters on TV. Soon after she learned how to talk, she asked her mother why she had named her like a boy, if she wanted to be a girl.

Flores and her ex-husband say they're convinced they've done right by their young daughter.

"We sought justice because our daughter had endured so much discrimination and uncomfortable moments whenever we had to deal with routine matters, paperwork or visits to the doctor," said her father, Gonzalo Araya.

In this July 1, 2017 photo, transgender girls Selenna, center right, and Mathilda, far right, walk on street stumps with other children outside La Moneda government palace during a Gay Pride march in Santiago, Chile. The government is backing a bill that would give adults the right to change the official records of their gender, though the measure has stalled in Congress, facing challenges from the Roman Catholic church and other traditional forces. (AP Photo/Esteban Felix)

"We've tried to look for information to help her be happy."

The increasing acceptance has led other transgender children to step out of the shadows, backed by their parents. Several took part in last month's Gay Pride parade in the Chilean capital.

Selenna, an 8-year-old with dark brown hair pulled back into a ponytail, brimmed with joy as she jumped around and played with other children.

Her mother, Evelyn Silva, said she struggled to find a school that would accept a girl whose birth certificate still lists her as a boy, though she finally succeeded.

In this July 8, 2017 photo, transgender girls Selenna, second from left, and Mathilda, right, play with a doll as their mothers attend a meeting on gender identity at a bookshop in Santiago, Chile. Selenna said she never liked celebrating her birthday because she would always get toy cars. "Maybe they didn't notice it," said Selenna. "But I was always (a girl)." (AP Photo/Esteban Felix)

Selenna, meanwhile, said she never liked celebrating her birthday because she would always get toy cars.

"Maybe they didn't notice it," said Selenna. "But I was always (a girl)."