In the midst of national Pride celebrations, the federal government announced new plans to expunge criminal convictions against Canadians once charged with crimes based on their sexual orientation, gender identity or gender expression.

The Liberal government plans to introduce new legislation by the end of the year that will pave the way for the past convictions to be erased.

Prime Minister Justin Trudeau made the announcement Wednesday as the Pride flag, Transgender Pride flag and the Canada 150 Pride flag were raised on Parliament Hill.

“I believe that it’s essential to make amends for past wrongs, not to simply gloss over them,” Trudeau told the crowd. “Today’s announcement and the forthcoming apology are important steps in the right direction.”

Homosexuality was decriminalized in Canada in 1969, but that didn’t end LGBT persecution. More than a decade later, nearly 300 men were arrested in a series of police raids at four bathhouses in Toronto on February 5, 1981, and charged with owning or being found in a common bawdy house.

The Toronto bathhouse raids triggered waves of protests against the police. The outcry has since been considered a pivotal turning point in Canadian LGBT history.

It wasn’t until 1992 that a federal court lifted a ban on gays and lesbians in the military. Same-sex marriage was legalized 13 years later, in July of 2005.

Trudeau said the government plans to apologize to the LGBT community by the end of 2017 for past discriminatory legislation, programs and policies.

“In Canada, we’ve come a long way, but there is still more work to be done. There is still work to do, fights to be had, here in Canada, and more and more, around the world,” he said.

The announcement comes on the heels of other legislation aimed at addressing inequalities facing the LGBT community. A bill that would add gender identity and gender expression to the list of prohibited forms of discrimination within the Criminal Code and Canadian Human Rights Act is currently before the Senate.

The federal government has also taken steps to repeal Section 159 of the Criminal Code, which places legal restrictions on consensual sex between same-sex couples.