Millions of Australians are celebrating Parliament's passage of same-sex marriage laws after decades of political debate, activism and a drawn-out postal survey.

But as Australia joins the dozens of nations that have already extended the right to marry to the LGBT community, there are still many places around the world where simply being gay carries with it the risk of jail or even death.

Most countries with similar cultural backgrounds to Australia have already legalised same-sex marriage — including the United States, Canada, England, Ireland, Scotland and Wales.

But same-sex marriage is not legal anywhere in Asia or the Middle East, and South Africa is the only country in Africa to have legalised it.

Even in Europe, the legal status of same-sex marriage is mixed.

The Netherlands became the first country in the world to legalise same-sex marriage in 2001.

Since then, countries such as Portugal, the United Kingdom, France, Spain and Germany have followed suit.

Austria's constitutional court recently overturned the country's laws which prevented same-sex couples marrying, paving the way for legalisation at the beginning of 2019.

But today in 2017, more than half of European Union members have not legalised it, including Italy, Greece and Poland.

Out of the countries that have legalised same-sex marriage, 21 have made the change via a parliamentary vote.

Court rulings prompted the change in five countries.

In Ireland a referendum was legally required to change the law, and it was overwhelmingly passed.

But Australia is the only country to have held a non-binding postal survey before making a parliamentary change.

Elsewhere in the world, LGBT people can struggle to simply stay out of jail.

There are more than 70 countries where homosexual acts are illegal.

The countries shaded in the map are those where there is a law that prohibits homosexual acts in part or all of the country.

Most of these countries fall within two main categories — just over half are former colonies mostly in Africa that inherited discriminatory laws but never repealed them, while the others are majority-Muslim countries.

What exactly is outlawed varies from country to country.

For example, 28 states only prohibit relations between men.

A common legal formulation is a prohibition of "carnal intercourse against the order of nature".

Not all the countries with these laws actually enforce them for consensual sex at home.

Even more severe, the death penalty is in place for same-sex sexual acts in at least 11 countries, according to the Lesbian, Gay, Bisexual, Trans and Intersex Association's annual report of "state-sponsored homophobia".

It finds the death penalty applies in Sudan, Iran, Saudi Arabia and Yemen and in parts of Nigeria and Somalia, though information on when the death penalty has been carried out is not readily available.

In theory, the death penalty could also be imposed in Mauritania, Afghanistan, Pakistan, Qatar and the United Arab Emirates through sharia law, but this does not appear to have occurred in practice.

So in Australia, like in many countries before it, the LGBT community will soon celebrate its first weddings.

But for many gay people throughout the world, this remains a distant dream.

Credits