Decriminalisation of homosexuality: History of gay rights in the UK
Today marks 50 years since it stopped being illegal for two men to be in a relationship in England and Wales. It's now seen as a big moment for gay rights.
This is called the decriminalisation of homosexuality. This means that this wasn't going to be a crime anymore.
The law changed in Northern Ireland and Scotland later. But it was never illegal for two women.
Even though the law changed in the UK, it is still illegal to be gay in some parts of the world.
Campaigners continue to work hard to get equal rights for gay people all over the world. So what happened in the UK and how have things changed?
What was life like for gay people?
For hundreds of years, gay people have struggled to be accepted and treated the same as people who are not gay.
They have been oppressed and even killed because of who they have feelings for.
Professor Brian Heaphy, an expert from the University of Manchester, explains: "Homosexuality was often treated as an illness by doctors and psychiatrists, who thought they could 'heal' people by treating them.
"Lesbian, gay, bisexual and transgender people were often forced to hide their identities from their families, friends, colleagues and in public to avoid the risk of being singled out, harassed or becoming a victim of violence."
There were laws that stopped gay people from having the same rights as people who were not gay. For example, they couldn't get married or adopt children.
Up until 1967, gay and bisexual men could face a maximum sentence of life in prison.
In the 1950s, a group was set up to look at the way gay men were treated by the law. It put together a report for the government that recommended that the law should be changed.
The government did not make the changes at first and more people started to campaign for the rights of gay people.
Eventually, the law was changed in 1967, which allowed two men to be in a relationship together without the fear of being arrested.
Even though this happened, there were still many laws in place at the time which meant that gay people did not have the same rights as people who were not gay.
More gay men were arrested after 1967 for things which they would not have been arrested for if their partner had been a woman.
What has happened since?
The change in the law in 1967 was just the beginning of many changes to improve gay people's rights.
So what else has changed over the last 50 years since this happened?
1969 - A series of demonstrations in New York called the Stonewall riots started after the police raided a bar called the Stonewall Inn, which was a popular place for gay people to hang out. It is said to be the start of the movement of people fighting for gay rights in the US.
1972 - The first Pride festival, which celebrates the gay community and supports equal rights, took place in London on 1 July. 2,000 people took part. Now, more than one million people celebrate it in the UK's capital, and Pride events take place all over the world.
1988 - A law called Section 28 was introduced which meant that teachers were not allowed to 'promote' gay relationships in schools. Many people argued that this prevented teachers from talking about gay relationships. It wasn't until 2003 that this was overturned.
2000 - A law was changed which allowed gay and bisexual people to be in the armed forces.
2002 - A law was changed to allow gay people (and also unmarried couples) to adopt children.
2003 - The ban on 'promoting' homosexuality in schools (Section 28) was overturned.
2004 - This year marked the start of civil partnerships for gay people. This meant that they had similar rights to people who were married, but civil partnerships are not exactly the same as marriage. Some people did not think it was good enough and that gay people should be allowed to get married.
2008 - It became illegal to encourage homophobic hatred. Last year, more than 7,000 hate crimes were reported against gay men and women in the UK.
2013 - Gay marriage was made legal in England and Wales, and later in Scotland. In Northern Ireland, gay marriage is not legal.
What is the situation now?
A lot has changed in the UK.
Peter Tatchell, a gay rights campaigner, told Newsround: "We have made fantastic progress. Compared to two decades ago, Britain is almost a different country. All the main anti-gay laws have been abolished. We are now one of the best countries in the world for gay equality."
Men who were convicted under the old laws that made being gay illegal can apply to have these taken off their record.
Peter says that attitudes towards gay people have changed too.
"Public attitudes are much more supportive, although there are still families who reject their gay children. We still have too much homophobic hate crime, many kids are still bullied and a lot of schools don't have an anti-bullying programme that specifically addresses anti-gay issues.
"There is big progress, but more needs to be done."
Today it is illegal to discriminate against somebody because they are gay, although many gay people face discrimination in their daily lives.
Peter says: "We want to get to a situation where no one cares what sexuality you are; where we accept the person and their right to love whoever they wish - male, female, both or neither."