Britain has made great strides towards gay equality since the first major law reform in 1999, which ended the ban on gay military personnel. In the last 16 years, we've gone from being the country with the largest number of homophobic laws in the world to being one of the most progressive nations in terms of legal rights for lesbian, gay, bisexual, transgender and intersex (LGBTI) people.
Far from being an easy, smooth transition, it has been a long, hard struggle, with many setbacks and some disappointing, half-baked reforms along the way.
The process of change began nearly half a century ago with the Sexual Offences Act of 1967. It was a milestone reform but not nearly as liberal as is generally assumed. Many people are under the false impression that it fully decriminalised - or even legalised - male homosexuality. How wrong they are. The reform was a very partial, limited decriminalisation. It applied only to England and Wales, and was not extended to Scotland until 1980 and to Northern Ireland until 1982.
The 1967 Act set the age of consent at 21 for sex between men, five years higher than the lawful age of 16 for sex between men and women. Aiding or facilitating some homosexual acts remained illegal, as did public displays of same-sex affection and men chatting up men in a public place. Gay sex was not prosecuted only if it took place in private, which was interpreted to mean in a person's own home, behind locked doors and windows, with the curtains drawn and with no other person present in any part of the house. It continued to be a crime if housemates were present in other rooms, if more than two men had sex together or if they filmed or photographed themselves having sex. They could be jailed for these crimes.
The centuries-old anti-gay laws were not repealed. They remained on the statute books under the heading: "Unnatural Offences". After the reforms of 1967, they were merely waived in particular, narrow circumstances. But many aspects of gay male life remained criminal.
In fact, in the four years after 1967, convictions for consensual gay offences rose by almost 400%. The authorities were more determined than ever to police any aspect of LGBTI life that fell outside the limited scope of decriminalisation.
In addition, homophobic discrimination in housing, employment and the provision of goods and services remained lawful by default. There was no legal protection against it. Thousands were denied employment or sacked from their jobs because of their sexual orientation or gender identity. Many others were refused, or evicted from, rented accommodation. They had no redress in law.
Victorian values and the gay plague
In the 1980s, the Conservative government's "family values" and "Victorian values" campaigns whipped up hysterical levels of homophobia; aided by the moral panic over Aids - which was widely dubbed the "gay plague". At the 1987 Conservative Party conference, Prime Minister Margaret Thatcher used her keynote speech to attack the notion that people had a "right" to be gay.
The consequence was a massive spike in queer-bashing murders and convictions for victimless same-sex acts. From 1986-91, there were at least 50 murders of men in circumstances that pointed to a homophobic motive. Police investigations to catch the killers were often derisory. We were still mostly criminals and, according to many police officers, didn't deserve the protection of the law.
In 1989, over 2,000 men were convicted of consenting adult same-sex relations; almost as many as in 1950-55 when male homosexuality was totally illegal and when Britain was gripped by a McCarthyite-style anti-gay witch-hunt.
The "gross indecency" law of 1885 prohibited any sexual contact between men, even simply touching and caressing. It had been used to convict the mathematical and computer genius Alan Turing in 1952 and, before him, to jail the playwright Oscar Wilde in 1895. It was repealed in only 2003. Likewise, the criminalisation of "buggery" (anal sex) - enacted in 1533 during the reign of King Henry VIII - was repealed a mere 11 years ago.
During the twentieth century, there were an estimated 50,000 to 100,000 convictions for consenting sex between adult males.
Since the Sexual Offences Act 2003, for the first time in over 500 years, the UK has a criminal code that does not discriminate on the grounds of sexual orientation.
As well equalising criminal statutes, the reforms of the last 16 years also ended the bans on LGBTI people serving in the armed forces and on same-sex couples fostering and adopting children. Gone is Section 28 which made the "promotion" of homosexuality by local authorities unlawful.
The legal non-recognition of transgender people is history. No longer do we have a lifetime prohibition on gay blood donors. The barring of same-sex couples from marriage is over - except in Northern Ireland where this exclusion still remains.
Public opinion has shifted dramatically too, with ever greater acceptance becoming the norm.
Nevertheless, according to the British Social Attitudes survey published in 2010, 36% of the public continue to believe that homosexuality is either "always" or "mostly" wrong. This is symptomatic of the reality that although homophobia has declined substantially, it isn't over yet.
One in three LGBTIs (well over half a million people) have been victims of homophobic hate crimes. The kicking to death of a 62 year-old gay man, Ian Baynham, in Trafalgar Square in 2009 is a reminder that even in liberal London LGBTI people are not always safe. Homophobic murders are nowadays rare but violent attacks still happen on a regular basis in London and other supposedly gay-friendly cities.
Fifty-five percent of young LGBTI people say they were bullied at school - with some of them suffering physical assaults in the classroom or playground. Despite this abuse, nearly half of all schools have no anti-bullying programme that explicitly tackles homophobia, biphobia and transphobia.
Some parents still boot their children out of home and onto the streets after discovering they are gay or lesbian. This is a significant cause of youth homelessness.
It's no surprise, then, that suicide, self-harm, mental ill-health, substance abuse and HIV infections are much higher among young LGBTIs than the general youth population. There is no room for complacency.
As we celebrate the amazing progress LGBTI people have won since 1999, it's clear that homophobia isn't over yet. Let's finish the job.
Peter Tatchell has been campaigning for human rights, democracy, global justice and LGBT liberation since 1967. His activism resulted in him being badly beaten by President Mugabe's bodyguards in 2001 and by Russian neo-Nazis in 2007. He is Director of the human rights organisation, the Peter Tatchell Foundation. A detailed biography is here: http://www.petertatchell.net/biography.htm.