Same-sex marriage, which Switzerland approved in a referendum today, is now legal in 30 countries, but homosexuality remains banned in many parts of the world.
Here is an overview of the global situation.
Europe, gay marriage pioneers
On 1 October, 1989, for the first time in the world, several gay couples in Denmark tied the knot in legal civil unions.
Danish homosexual couples would, however, have to wait until 2012 to be allowed to marry.
The right to a marriage ceremony was first allowed in the Netherlands in 2001.
Thirteen European countries followed: Belgium, Britain, Finland, France, Germany, Iceland, Ireland, Luxembourg, Malta, Norway, Portugal, Spain and Sweden.
Austria allowed gay marriage from 2019.
In Switzerland, same-sex couples could only register a civil partnership until the parliament approved marriage late last year.
Opponents launched a referendum against the decision under Switzerland's direct democracy system, only to be defeated by today's vote, in which 64% backed same-sex marriage.
Some countries allow only civil partnerships for same-sex couples, including Croatia, Cyprus, the Czech Republic, Greece, Hungary and Italy.
The Czech government has backed draft legislation that would make the country the first post-communist member of the European Union to legalise same-sex marriage, but its fate is uncertain.
Slovenia also allows civil partnerships but in 2015 rejected in a referendum a proposal to legalise gay marriage.
In 2014 Estonia became the first former Soviet republic to authorise same-sex civil unions.
In Romania a referendum aimed at enshrining a ban on gay marriage in the constitution failed in 2018 because of a low turnout.
Progress in the Americas
Canada was the first country in the Americas to authorise same-sex marriage in 2005.
In 2015 the US Supreme Court legalised gay marriage nationwide at a time when it was banned in 14 out of 50 states.
However the United States' first gay marriage actually took place in 1971, when a Minnesota couple obtained a marriage licence thanks to an overlooked legal loophole. The marriage was officially recognised in March 2019, after a five-decade legal battle.
In Latin America, six countries allow same-sex marriages: Argentina, Brazil, Colombia, Ecuador, Uruguay and Costa Rica.
Mexico's federal capital authorised gay civil unions in 2007 and marriages in 2009. Half of its 32 states have followed.
Chile legalised same-sex civil unions in 2015.
Cuba left out of its new constitution - adopted in 2019 - changes that would have paved the way for legal same-sex marriage. In 2021, a draft of a new family code opened the door to same-sex marriage, but it will be put to a referendum.
Taiwan, first in Asia
While much of Asia is tolerant of homosexuality, Taiwan in May 2019 became the first in the region to allow same-sex marriage.
In Japan, a court in northern Sapporo ruled in 2021 that the country's failure to recognise same-sex marriage is unconstitutional, in a landmark first verdict on the issue.
Australia (2017) and New Zealand (2013) are the only places in the wider Asia-Pacific region to have passed gay marriage laws.
In the Middle East, where homosexuality is in many countries repressed, Israel leads the way in terms of gay rights, recognising same-sex marriages that are sealed elsewhere although not allowing such unions in the country itself.
Several countries in the conservative region still have the death penalty for homosexuality, including Saudi Arabia and the United Arab Emirates.
Africa: marriage in one country
South Africa is the sole nation on the African continent to allow gay marriage, which it legalised in 2006.
Around 30 African countries ban homosexuality, with Mauritania, Somalia and Sudan having the death penalty for same-sex relations.