On Wednesday, May 24, Taiwan's highest court ruled that the island's ban on same-sex marriage is unconstitutional, paving the way for the island to be the first Asian country to legalize same-sex marriage.

How'd it happen?

Petitions for same-sex marriage in the country have been submitted for decades now. In 1986, while Taiwan was still under martial law, activist Chi Chia-Wei came out as homosexual -- an action that got him 168 days in jail until he was eventually pardoned. Chi has been crusading for his cause since, and his petition was finally accepted for review in February of this year, according to Quartz, although he had been ruled against by Taiwan's Constitutional Court twice before today.

His petition was bolstered by the request of the Taipei City Government for the court to review its interpretation of marriage laws.

“I was not discouraged by the setbacks," Chi told the Taipei Times. "That is how I have been able to carry on for so long. My belief is that if you can do one right thing in this life, it’s all worth it.”

Gay couples in Taiwan have never had legal recognition of their union. But by 2015, two cities, including Taipei, were issuing non-legally binding same-sex partnership cards that allowed couples to claim paid family leave and sign medical consent forms, according to the China Post. Still, deeply ingrained social and legal stigma had prevented much progress through the legal system above city-by-city level.

Activists like Chi have been pushing against this stigma for years now. Taipei's annual pride parade is the largest in Asia, with over 500,000 participants a year. Despite growing support, the Legislative Yuan, Taiwan's law-making branch, has yet to address the issue completely.

The Court's Ruling

This ruling, however, does not mean that all same-sex couples can now legally be married.

It does, however, strike down the official definition that marriage can only be between a man and a woman. According to a press release discussing the ruling, the Legislative Yuan now has two years to enact amendments to Taiwan's Civil Code or pass a law legalizing same-sex marriage.

The Constitutional Court referenced the slow pace of the Legislative Yuan in its ruling, released at 4 pm in Taiwan.

The court based its decision largely on the basis of Taiwan as a free, democratic society, whose Constitution defines all its citizens as "equal under the law." Justices also cited the evidence that homosexuality is not a disease, as it has often been historically categorized, but natural.

"The need, capability, willingness and longing, in both physical and psychological senses, for creating such permanent unions of intimate and exclusive nature are equally essential to homosexuals and heterosexuals, given the importance of the freedom of marriage to the sound development of personality and safeguarding of human dignity," read the release.

What's next?

This two-year grace period still leaves the legislature a great deal of freedom to decide to what extent equal rights will be applied to gay couples' union.

Cindy Sui, of the BBC, suggested that the Legislative Yuan could give same-sex couples the right to marry but withhold their ability to take advantage of all the rights opposite-sex spouses have, like family leave or tax breaks.

Religious and conservative groups, who have been upping the ante at protests against such a decision ever since Taiwan's new, pro-gay marriage president took office last year, promise to push against the ruling and the legislature hard.

President Tsai Ing-wen said in December 2016 that Taiwan's approach to same-sex marriage would be a "test of the maturity of our society."

In China, which claims Taiwan as its territory, gay rights activists have long hoped that Taiwan's new progressive government could provide some momentum for their own protests and petitions.

A court there recently turned down a petition for marriage by a gay couple. The moment was historic, nonetheless, because it was the first time a Chinese court had agreed to even hear such a case. This new ruling has not yet received a response from the Communist Party.

This is not the end of the struggle for gay rights in Taiwan. But the challenges ahead cannot take away from the celebrations to be had today. For today, the rainbow flag may fly proudly over the island.