At the time of legalization (for the above), the age of consent, rape, defences, etc. Western Australia legalised male homosexuality in 1989 – Under the Law Reform (Decriminalization of Sodomy) Act 1989, as did New South Wales and the Northern Territory in 1984 with unequal ages of consent of 18 for New South Wales and the Northern Territory and 21 for Western Australia.Then since 1997, the states and territories that retained different ages of consent or other vestiges of sodomy laws have tended to repeal them later; Western Australia did so in 2002, and New South Wales and the Northern Territory did so in 2003.Tasmania was the last state to decriminalise sodomy, doing so in 1997 after the groundbreaking cases of Toonen v Australia and Croome v Tasmania (it is also notable that Tasmania was the first jurisdiction to recognize same-sex couples in Australia since 2004 under the Relationships Act 2003.
Most sodomy related laws in Western civilization originated from the growth of Christianity during Late Antiquity.
In England, Henry VIII introduced the first legislation under English criminal law against sodomy with the Buggery Act of 1533, making buggery punishable by hanging, a penalty not lifted until 1861.
In 1786 Pietro Leopoldo of Tuscany, abolishing death penalty for all crimes, became not only the first Western ruler to do so, but also the first ruler to abolish death penalty for sodomy (which was replaced by prison and hard labour).
In France, it was the French Revolutionary penal code (issued in 1791) which for the first time struck down "sodomy" as a crime, decriminalizing it together with all "victimless-crimes" (sodomy, heresy, witchcraft, blasphemy), according with the concept that if there was no victim, there was no crime. Texas that state laws criminalizing private, non-commercial sexual activity between consenting adults at home on the grounds of morality are unconstitutional since there is insufficient justification for intruding into people's liberty and privacy.
The exception was Tasmania, which retained its laws until the Federal Government and the United Nations Human Rights Committee forced their repeal in 1997.
Male homosexuality was decriminalised in the Australian Capital Territory in 1976, then Norfolk Island in 1993, following South Australia in 1975 and Victoria in 1981.The same principle was held true in the Napoleon Penal Code in 1810, which was imposed on the large part of Europe then ruled by the French Empire and its cognate kings, thus decriminalizing sodomy in most of Continental Europe. As of 2017, sodomy related laws have been repealed or judicially struck down in all of Europe, North America, and South America, except for Antigua and Barbuda, Barbados, Dominica, Grenada, Guyana, Jamaica, Saint Kitts and Nevis, Saint Lucia, Saint Vincent and the Grenadines, and Trinidad and Tobago.In 1830, Emperor Pedro I of Brazil signed a law into the Imperial Penal Code. After the publishing of the Wolfenden report in the UK, which asserted that "homosexual behaviour between consenting adults in private should no longer be a criminal offence", many western governments, including the United States, have repealed laws specifically against homosexual acts. There have never been Western-style sodomy related laws in the People's Republic of China, Taiwan, North Korea, South Korea, or Vietnam.For example, male homosexual acts, at least in theory, can result in life imprisonment in Barbados and Guyana.In Africa, male homosexual acts remain punishable by death in Mauritania, Sudan, and some parts of Nigeria and Somalia.Following Sir William Blackstone's Commentaries on the Laws of England, the crime of sodomy has often been defined only as the "abominable and detestable crime against nature", or some variation of the phrase.