Ecuador on Wednesday became one of 28 countries to legalise same-sex marriage, but in many other parts of the world homosexuality is illegal and sometimes subject to the death penalty.
Here is an overview.
Progress in the Americas
The ruling by the highest court in traditionally Catholic Ecuador to approve same-sex marriage overrides the current constitution which defines marriage as between a man and a woman.
Ecuador follows Argentina, Brazil, Colombia and Uruguay in allowing same-sex marriages in Latin America.
Mexico's federal capital was the pioneer in the region, authorising gay civil unions in 2007 and marriages in 2009. Nearly half of its 32 states have followed.
Chile legalised gay civil unions, which come with fewer rights, in 2015.
Costa Rica's Supreme Court in August 2018 ruled that a ban on same-sex marriages was unconstitutional and gave parliament 18 months to amend the laws.
Cuba decided in December 2018 to leave out of its new constitution changes that would have paved the way for legal same-sex marriage.
Canada was the first American country to authorise same-sex marriage and adoptions in 2005, and 10 years later the United States legalised gay marriage nationwide.
Europe, gay marriage pioneers
The Netherlands in 2001 became the first country in the world to allow gay couples to marry.
Fourteen European countries followed: Belgium, Britain -- although not Northern Ireland -- Denmark, Finland, France, Germany, Iceland, Ireland, Luxembourg, Malta, Norway, Portugal, Spain and Sweden.
Austria allowed gay marriage from 2019 and the Czech Republic government backs draft legislation that would legalise same-sex marriage.
Some countries allow only gay civil partnerships, including Croatia, Cyprus, Greece, Hungary, Italy and Switzerland.
In Russia homosexuality was considered a crime up to 1993 and a mental illness until 1999. Now legal, a 2013 law however punishes the promotion of homosexuality among minors.
In Romania a referendum aimed at restricting the definition of marriage to exclude same-sex couples failed in October 2018 because of a low turnout.
Taiwan, first in Asia
While much of Asia is tolerant of homosexuality, Taiwan became in May the first in the region to allow gay marriage.
Vietnam decriminalised gay marriage celebrations in 2015 but stopped short of full legal recognition for same-sex unions.
Australia and New Zealand are the only places in the wider Asia-Pacific region to have passed gay marriage laws.
Homosexuality is outlawed in the region's Muslim countries, such as Bangladesh, Malaysia and Pakistan.
Brunei sparked a worldwide backlash in April when it introduced laws that include death by stoning for gay sex. A month later it said the laws would not be enforced.
In China, where homosexuality was classified as a mental illness until 2001, discrimination remains widespread.
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.
Gay sex is decriminalised in only a handful of countries: Angola, Lesotho, Mozambique and the Seychelles.
Botswana's High Court on June 11 ruled in favour of decriminalising homosexuality; Kenya in February postponed ruling on the same question.
Middle East: repressed
Several countries in the conservative region still have the death penalty for homosexuality, including Saudi Arabia and the United Arab Emirates.
Israel leads the way in terms of gay rights, recognising same-sex marriages that are performed elsewhere although not allowing such unions in the country itself. Gay couples can adopt children.
Lebanon is also more tolerant than other Arab countries.