On Tuesday, dozens of people with rainbow flags, scarves and banners gathered before the Supreme Court of the Philippines in Manila as justices considered a petition calling for the legalization of same-sex marriage. While bills legalizing same-sex marriage have surfaced before in the Philippines, this was the first time the issue was brought before the highest court in the majority-Catholic country.

A 2013 Pew Research Center report found that more than 70 percent of Filipinos say that homosexuality should be accepted, making it the second most gay-friendly country in the Asia-Pacific region. But while growing LGBT advocacy has been met with strong resistance from the Catholic Church and conservative groups, activists have gained an unlikely ally: President Rodrigo Duterte.

Duterte, who has been cited repeatedly by human rights groups for his bloody anti-drug crackdown, has consistently expressed support for the acceptance of LGBT Filipinos. In 2012, as the vice mayor of Davao City, Duterte encouraged a local council to pass an anti-discrimination ordinance protecting the LGBT community, making Davao City one of the first regions in the Philippines to do so. In 2015, he said on national television that he opposes the "bullying" of gay people.

But Duterte has also wavered over his support of same-sex marriage. During the 2015 television interview, he said that same-sex marriage is "good" because "everyone deserves to be happy." He then backtracked on that position in March 2017, telling journalists that same-sex marriage and other issues around sexuality and gender were part of Western culture, not Filipino culture.

"That’s for them. That can’t apply to us, because we are Catholics," he said. "[T]here is the civil code, which states you can only marry a woman for me, and for a woman to marry a man. That’s the law in the Philippines.”

Less than eight months later, Duterte changed his tune again, telling an LGBT audience in Davao City: “I want same-sex marriage. The problem is, we'll have to change the law, but we can change the law.”

Duterte's shifts on same-sex marriage may be linked to his ongoing feud with the Catholic Church in the Philippines.

Eighty percent of Filipinos identifies as Catholic, and the church has long wielded wide-ranging political influence in the country. But their power has increasingly come under attack by Duterte, who has called the Catholic Church hypocritical” for condemning the thousands of killings that have taken place during his anti-drug crackdown. In response, church leaders have organized vigils for those killed by Duterte’s administration and denounced what they describe as his “reign of terror” against the poor.

This war of words escalated in recent months with the killings of three Catholic priests. Clergy leaders have partly attributed their deaths to Duterte and his government for cultivating a culture of "impunity" that has allowed the crimes. Last week, Catholic leaders signed a statement calling on Duterte "to stop the verbal persecution" against the church "because such attacks can unwittingly embolden more crimes against priests." Duterte has reacted to the appeals in defiance, calling church leaders "fools" for attempting to discredit his government.

But it's still unclear whether the tension between Duterte and the church will lead Duterte to back the same-sex-marriage petition. Jesus Falcis, an openly gay lawyer spearheading the petition, told the South China Morning Post that while Duterte has yet to take concrete steps to support same-sex marriage, "his pronouncements create a more conducive environment to talk about [the issue]."

Read more: