Video caption Crowds celebrate as marriage law passes

Taiwan's parliament has become the first in Asia to legalise same-sex marriage following a vote on Friday.

In 2017, the island's constitutional court ruled that same-sex couples had the right to legally marry .

Parliament was given a two-year deadline and was required to pass the changes by 24 May.

Lawmakers debated three different bills to legalise same-sex unions and the government's bill, the most progressive of the three, was passed.

Image copyright Getty Images Image caption Gay rights activists bearing umbrellas and rainbow flags erupted in joy as the ruling was announced

Thousands of gay rights supporters gathered in the rain outside the parliament building in the capital, Taipei, to await the landmark ruling.

There were shouts of joy and some tearful embraces as the result was announced.

However, conservative opponents were angered by the vote.

What does the bill entail?

The two other bills, submitted by conservative lawmakers, refer to partnerships as "same-sex family relationships" or "same-sex unions" rather than "marriages".

But the government's bill, also the only one to offer limited adoption rights, was passed by 66 to 27 votes - backed by lawmakers from the majority Democratic Progressive Party.

It will take effect after Taiwan's President Tsai Ing-wen passes it into law.

Several same-sex activists had said ahead of the vote that this was the only version they would accept.

Image copyright EPA Image caption Hundreds of gay and lesbian couples have already applied to register for legal union

"I'm very surprised - but also very happy. It's a very important moment in my life," Jennifer Lu, chief co-ordinator of rights group Marriage Equality Coalition Taiwan, told the BBC.

"However, it's still not full marriage rights; we still need to fight for co-adoption rights, and we are not sure about foreigner and Taiwanese marriage, and also gender equality education.

"It's a very important moment, but we are going to keep on fighting. We are Taiwanese and we want this important value for our country, for our future," she added.

"For me the outcome today is not 100 percent perfect, but it's still pretty good for the gay community as it provides legal definition," said Elias Tseng, a gay pastor who spoke to the AFP news agency outside parliament.

Taiwanese singer Jolin Tsai posted a picture of a rainbow on Facebook accompanied by the caption "Congratulations!! Everyone deserves happiness!"

How did we get here?

In 2017, Taiwan's constitutional court ruled that same-sex couples had the right to legally marry.

It said then that the island had two years to make necessary changes to the law.

But this was met with a public backlash, which pressured the government into holding a series of referendums.

The referendum results showed that a majority of voters in Taiwan rejected legalising same-sex marriage , saying that the definition of marriage was the union of a man and woman.

Image copyright Reuters Image caption Same-sex marriage supporters cried after hearing the result of the referendum

As a result, Taiwan said it would not alter its existing definition of marriage in civil law, and instead would enact a special law for same-sex marriage.

What reaction has there been?

Many took to social media in celebration, seeing the result as a win for marriage equality.

"What a tremendous victory for LGBT rights!" said Phil Robertson, deputy Asia director at Human Rights Watch.

"Taiwan's action today should sound a clarion call, kicking off a larger movement across Asia to ensure equality for LGBT people."

Earlier on Friday, Ms Tsai said in a tweet that the island had taken "a big step towards true equality" with the vote.

Sorry, this Twitter post is currently unavailable.

Meanwhile, Tseng Hsien-ying, from the Coalition for the Happiness of Our Next Generation, told AFP news agency the vote had "trampled on Taiwanese people's expectations that a marriage and a family is formed by a man and a woman, a husband and a wife".

Others expressed opposition on social media.

"This is the death of democracy. Seven million people voted against same-sex marriage in the referendum and their votes meant nothing.

"Is same-sex marriage that important and urgent?", Liu Yan wrote on Facebook.

How does this compare to other countries in the region?

Taiwan has been a leader for gay rights in Asia, hosting an annual gay pride parade in Taipei attended by LGBT groups from all over the continent.

The law was also celebrated by many LGBT people in the region. Paul Ng, from Singapore, told the BBC he and his friends saw it as "an occasion to celebrate, even though we're not Taiwanese. It's a success for us, for all gay people."

"For Singaporeans, this is especially important because our government likes to go on and on about preserving 'Asian' values… so this sends a very important message to other developed nations in Asia."

Wong Ka Ying, an LGBT artist in Hong Kong, said that Taiwan's decision would help raise awareness, although she doubted it would make an impact in "more conservative" places like Hong Kong or mainland China.

Vietnam decriminalised gay marriage celebrations in 2015, but stopped short of granting full legal recognition for same-sex unions.

While same-sex marriage is still illegal in China, homosexuality was decriminalised in the country in 1997, and officially removed from its list of mental illnesses three years later.

Elsewhere in Asia, laws are changing to reflect more tolerant attitudes towards LGBT groups.

In a historic decision, India's Supreme Court ruled that gay sex was no longer a criminal offence in September 2018.

However the approach differs in other Asian countries.

In April, Brunei announced strict new Islamic laws that made anal sex and adultery offences punishable by stoning to death, but it says it will not enforce the death penalty for gay sex.