I met Chi Chia-wei in November 2016 while covering a rally in support of same-sex marriage in Taipei.

Waving a large rainbow flag, and wearing another for good measure, he told me how he had been jailed after coming out as gay in 1986, when Taiwan was nearing the end of four decades of martial law under the Kuomintang. Chi said he was released early by a teary-eyed judge who felt his imprisonment was unjust.

In the three decades since Chi's ordeal, Taiwan has democratized and become significantly more tolerant. Though much of the island's older population remains quite conservative, the push for same-sex marriage that Chi began has gathered what would then have been considered unimaginable momentum.

Patient and persistent, Chi told me he did not know whether Taiwan's legislature would approve bills under discussion before the 2016-2017 winter recess. But he was not worried. "If we don't get marriage equality this time, we will eventually, and that day is not far off," he said.

Six months later, Taiwan's constitutional court ruled that laws preventing same-sex unions were unconstitutional, ordering the passage of legislation to address the issue within two years. The ruling followed the most recent of several lawsuits filed by Chi that challenged Taiwan's marriage laws, bolstered by a parallel suit filed by the Taipei city government.

In late October, Chi was among the Taiwan Pride parade's 120,000-plus participants from 20 countries, mostly drawn from other parts of Asia where marriage equality seems a distant possibility. A record turnout, it eclipsed last year's 80,000, cementing Taiwan's status as a focal point for Asia's lesbian, gay, bisexual and transgender community.

More recently, 10,000 people marched through downtown Hong Kong in the Chinese-administered territory's annual LGBT pride parade. Marchers carried a giant rainbow flag through the heart of Hong Kong, which has roughly the population of greater Taipei.

Although it looks unlikely that Taiwan will pass a same-sex marriage bill during the current legislative session, marriage equality will automatically become the law of the land in May 2019, if legislation has not passed earlier.

Since the Taiwan ruling, a national postal survey in Australia has shown majority support for same-sex marriage, which has yet to be written into law. LGBT rights are slowly making gains elsewhere, too.

A recent court ruling in Hong Kong granted a visa to a British woman in a civil partnership with a Hong Kong resident. The territory is also to be the first Asian city to host the Gay Games -- in 2022.

Earlier this year, Sapporo became the latest local government in Japan to recognize same-sex partnerships, helping partners to receive insurance payments and other economic benefits afforded to family members. Tokyo's Shibuya Ward was the first to take this step, in 2015.

Laws forbidding discrimination are on the books in Nepal, where a government commission recommended in 2015 that same-sex marriage be legalized, but legislators have yet to follow through. Same-sex unions in Vietnam are permitted, although not yet legally recognized.

A question of identity

Taiwan's leadership on this issue reflects a search for identity after the end of martial law in 1987. Many Taiwanese questioned the Chinese identity enforced by the Chinese nationalist Kuomintang, whose dictatorship after World War II followed half a century of Japanese colonial rule.

Taiwan's transition toward democracy allowed public discussion of many previously suppressed issues, including government abuses under martial law, environmentalism, press freedom, women's rights and LGBT rights.

Same-sex marriage in self-governed Taiwan is now inevitable, but those fighting for marriage equality in Hong Kong are likely to have a longer battle ahead. Despite growing social acceptance of LGBT rights in China, Beijing has discouraged media discussion of Taiwan's quest for marriage equality.

In line with recent tradition, this year's Taiwan Pride parade finished outside the former headquarters of the Kuomintang, the party that imprisoned Chi for being gay. This year it was a backdrop for selfies of people in rainbow attire, some in drag.

With poetic irony, Taiwan appears to be discovering its own identity as a consequence, at least in part, of leading Asia toward greater tolerance for the once-closeted LGBT community.

Chris Horton is a Taipei-based writer.