In a landmark ruling this week, the Indian Supreme Court didn’t simply strike down Section 377, the odious British-introduced law criminalizing homosexual acts — it did so in a judgment of remarkable scope and eloquence.

The judgment opens with a quote from Goethe: “I am what I am, so take me as I am.” It relies on knowledge from psychology and science to support its reasoning, even giving a nod to rainbow symbolism (“different hues and colours together make the painting of humanity beautiful”). Most of all, it is a heartfelt discourse from the justices to their nation on the importance of human rights and diversity, an invitation to move “from bigotry to tolerance,” to serve “as the herald of a new India.”

Originally imposed in the 19th century, Section 377 was provisionally invalidated in 2009, prompting many Indians to cautiously begin coming out. But in a cruel 2013 reversal, two justices granted the petition of an assortment of self-styled moralists and religious groups and reinstated the law. They ruled that the Indian L.G.B.T. population was a “minuscule fraction” too small to warrant protection.

The new judgment bluntly labels this argument “fallacious” and “constitutionally impermissible.” The justices turn to mathematical metaphor to drive home their point: The idea of population size, they write, “in this context, is meaningless; like zero on the left side of any number.” More strikingly, they quote a compendium of international decisions supporting gay rights, in stark opposition to the 2013 justices who declared they would not be swayed by such foreign endorsements. It’s impossible, of course, to know the intentions of the five justices who wrote the unanimous decision. But in reading the ruling, it’s hard to avoid concluding that the judges may have been deliberately attempting to pick up the torch from Western democracies and make India the newest beacon of hope for L.G.B.T. populations languishing in repression around the globe.