Anal sex is to be decriminalised in Canada.

The country's centre-left Liberal government has said it intends to repeal Section 159 of the criminal code, which states that every person who engages in an act of anal intercourse is guilty of an “indictable offence” and “liable to imprisonment for a term not exceeding ten years”.

Exceptions are made in the law for heterosexual married couples and for any two people over the age of 18 who both consent to the act. However anal sex is illegal for 16 and 17 year olds, in public places, and if more than two people “take part or are present”.

LGBT rights activists say the law is discriminatory because the legal age of consent for anal sex differs from the age of consent for almost all other forms of sex.

People in Canada can legally have vaginal and oral sex when they are 16, as long as this does not involve prostitution or pornography, and the sex act does not occur “in a relationship of authority, trust or dependency,” such as with a teacher or coach.

Section 159 has been ruled unconstitutional by several different courts in cases spanning three decades. In the 1990s, Ontario’s Court of Appeal said the law violated Section 15 of the Canadian Charter by discriminating on the basis of age. Appellate courts in Quebec, Alberta, B.C. and Nova Scotia, and at the federal level, followed suit.

Justice Rosalie Abella, for the Court of Appeal for Ontario, said in 1995:

“Gays and lesbians form a historically disadvantaged group, and s. 159 violates s. 15(1) of the Charter because it arbitrarily disadvantages individuals in that historically disadvantaged group—gay men—by denying to them until they are 18 a choice available at the age of 14 [the age of consent at the time] to those who are not gay, namely, their choice of sexual expression with a consenting partner to whom they are not married. Anal intercourse is a basic form of sexual expression for gay men.”

But the ban has remained written in the law and police have been found to be actively enforcing it in five provinces and three territories, according to the charity Equality for Gays and Lesbians Everywhere Canada (Egale).

In a report released in June, the charity said police had taken advantage of the law’s "ambiguity" and continued to use it to charge Canadian citizens.

It said: “Between 2008 and 2014 in Ontario, 22 people were charged with anal intercourse under Section 159".

The report also said Canadian gay rights activists were “mortified” that Stephen Harper's government, who were in power until 2015, did not address Section 159 when it reviewed the age of consent for sexual activity in 2008.

The pioneers of LGBT rights in 2015 Show all 6 1 /6 The pioneers of LGBT rights in 2015 The pioneers of LGBT rights in 2015 Justice Anthony Kennedy and the other Supreme Court Justices who legalised same sex marriage in the US The US Supreme Court legalized same-sex marriage is all 50 states of America in June, splitting 5-4 in favour. Writing the majority opinion, Justice Kennedy said gay people hope not to be condemned to live in loneliness, excluded from one of civilization’s oldest institutions. The pioneers of LGBT rights in 2015 Caitlyn Jenner After she revealed her new self in an interview and cover with Vanity Fair magazine in June, the former olympian quickly became the most famous trans person in the world. AFP/Getty The pioneers of LGBT rights in 2015 Cara Delevigne The former model said she identified as bisexual in an interview with Vogue in July. AFP/Getty The pioneers of LGBT rights in 2015 Ellen Page The openly gay actress confronted Republican presidential candidate Ted Cruz at a campaign rally in Iowa in August over laws that discriminate against the LGBT community. AFP/Getty The pioneers of LGBT rights in 2015 iO Tillett Wright The artist and Instagram star began the Self Evident Truths project in 2015 to photograph everyone who doesn’t identify as “100% straight”. Famously it featured Johnny Depp’s teenage daughter Lily Rose who said she fell “somewhere on the vast spectrum” and singer Selena Gomez who addressed rumours she was dating Cara Delevigne. AFP/Getty The pioneers of LGBT rights in 2015 Ruby Rose Australian born Rose was one of the very first celebrities to come out as genderfluid. She was hailed for giving it a public platform a the MTV Europe Music Awards in October when she welcomed “ladies and gentlemen, and everyone in-between” in her introduction.

A New Democratic Party MP tried to have the ban revoked in 2011, but the bill never made it to the first round of debate.

Dr Kristopher Wells, the faculty director of the Institute for Sexual Minority Studies at the University of Alberta, told VICE he applauds Prime Minister Justin Trudeau's "government for continuing to make Canada a human rights leader around the world.”