Brunei is introducing new laws that make sex between men an offence punishable by stoning to death.
It joins Iran, Saudi Arabia, Yemen, Sudan, Mauritania and parts of Nigeria and Somalia, which also impose the death penalty for same-sex relationships, according to the International Lesbian, Gay, Bisexual, Trans and Intersex Association (ILGA).
Identifying which countries have actually carried out these punishments, though, is difficult.
Amnesty International says it has had no reports of executions under anti-homosexuality laws in the past few years.
However, there have previously been reports of executions in Iran and Saudi Arabia.
Nigeria has the punishment of stoning in its Muslim-majority northern states - but it has never been carried out.
Where is gay sex illegal?
Homosexuality was already illegal in Brunei and carried a punishment of up to 10 years in prison.
The new measures introduced in Brunei also criminalise sex between women, carrying a penalty of 40 strokes of the cane and/or up to 10 years in jail.
There are currently 70 countries that criminalise same-sex relations, according to the ILGA.
Other countries have some form of legal restriction.
Russia is included - even though same-sex relationships were formally legalised in 1993. This is because "a variety of repressive legal provisions" have come into force over the past decade, according to the ILGA.
In many places, breaking these laws is punishable by long prison sentences, fines or even corporal punishment.
Many of the states criminalising homosexual relations are Commonwealth countries (35 in total) with legal statutes originating from British colonial times.
The Commonwealth Secretary General, Patricia Scotland, has urged the government of Brunei to reconsider the new punishments, which, she says, "will potentially bring into effect cruel and inhuman punishments which contravene international human rights law and standards".
A ruling by the Indian Supreme Court in 2018 removed India from the list of states that explicitly outlaw gay sex.
India's membership of the Commonwealth had made its ruling, striking down a colonial-era law, particularly significant, said Tea Braun of the Human Dignity Trust, a UK-based charity that supports those challenging anti-gay laws.
"Its dismantling by the Indian Supreme Court, after over a century and a half of oppression against LGBT people, signals a change in tide for the world," she told BBC News.
In a number countries, legal challenges could bring about change:
- In Kenya, the High Court is due to rule on whether to decriminalise homosexuality, on 24 May
- In Botswana, a judgment from the High Court on a legal challenge to criminalisation is due this year
- In Jamaica, laws criminalising gay relations are facing a challenge
Gay marriage is now legal in 26 countries worldwide, the ILGA says.
Brazil and Mexico are also on the ILGA's list because "through one legal route or another, it appears to be possible to marry in most jurisdictions".
Countries where gay marriage is now legal:
- 2001 Netherlands
- 2003 Belgium
- 2005 Canada, Spain
- 2006 South Africa
- 2009 Norway, Sweden
- 2010 Iceland, Portugal, Argentina
- 2012 Denmark
- 2013 Uruguay, New Zealand, France, Brazil
- 2014 UK (Northern Ireland in 2019)
- 2015 Luxembourg, Republic of Ireland, Mexico, USA
- 2016 Colombia
- 2017 Finland, Malta, Germany and Australia
- 2019 Austria
And in August 2018, Costa Rica's top court overturned a ban on same-sex marriage and gave legislators 18 months to change the law.