Justin Trudeau, leader of the Liberal Party of Canada, marches in the 37th Annual Vancouver Pride Parade in Vancouver, British Columbia August 2, 2015. (Ben Nelms/Reuters)

OTTAWA — For almost a decade, Canada’s Conservative prime minister, Stephen Harper, consistently refused to march in the gay pride parades that are major summer events in Toronto, Montreal and Vancouver.

Justin Trudeau, then an opposition politician of the Liberal Party, always made a point of turning out. This summer, he plans to attend the Montreal event as prime minister.

To mark the International Day Against Homophobia, Transphobia and Biphobia, Trudeau’s six-month-old government followed through Tuesday on an election promise and introduced a broad piece of legislation that would protect transgender Canadians from discrimination.

“Today is about ensuring that all people, regardless of sexual orientation or gender identity, feel safe and secure and empowered to freely express themselves,” Trudeau said in a statement. “As a society, we have taken many important steps towards recognizing and protecting the legal rights for the lesbian, gay, bisexual, transgender, queer/questioning or two-spirited community.”

The bill would make discrimination in the workplace illegal based on gender identity or expression and includes protections for transgender Canadians under the country’s anti-hate-crime legislation. Similar efforts in the United States have provoked a backlash at the state level from conservatives, who have promoted "bathroom bills" aimed at requiring people to use the public restroom that matches the gender on their birth certificates, rather than the one with which they identify.

The U.S. Justice Department and North Carolina sued each other last week over a state law that contains such a requirement. North Carolina said its law does not discriminate against transgender people, but the Justice Department’s civil rights office called it discriminatory and said it violates civil rights.

The Canadian legislation was announced at a news conference by Justice Minister Jody Wilson-Raybould. She was accompanied  by Charlie Lowthian Rickert, a 10-year-old transgender girl from the Ottawa area, who said the law would help Canadian children like her “so we can live a more accepting, a more joyful life in the future.”

Charlie Lowthian-Rickert, left, who is a transgender female, is comforted by her dad and friends after legislation was announced May 17 to protect transgender Canadians from discrimination. (Sean Kilpatrick /The Canadian Press via AP)

Similar proposals were presented as private bills on a few occasions during the Harper years (from 2006 to 2015) but never made it through Canada’s Parliament, as Conservatives blocked the efforts. In 2013, one Conservative senator who helped scupper a bill said its passage “would allow perverts to take advantage of the law” by allowing them access to women’s restrooms under the guise of being transgender.

This time, with government backing, the legislation is expected to pass.

Harper himself was an outspoken opponent of same-sex marriage before it was legalized in Canada in 2005, but once in power he backed off efforts to kill the law. Because of the support Harper received from Christian evangelicals, however, he was careful never to be seen as backing LGBT causes.

Trudeau’s transgender legislation follows a series of other measures, including the proposed legalization of marijuana use, an assisted-suicide bill and broader acceptance of Syrian refugees, that have marked the Liberal government’s rejection of Conservative-oriented policies since coming to power in the fall.

On Monday, an LGBT group in Montreal honored Trudeau with an award for supporting its cause. His late father, former prime minister Pierre Trudeau, had also fought homophobia and had earlier received the same award posthumously. Pierre Trudeau died in 2000.

In 1967, as Canada’s justice minister, Pierre Trudeau announced plans to decriminalize homosexuality by famously stating that “there’s no place for the state in the bedrooms of the nation.”

“And what’s done in private between consenting adults doesn’t concern the Criminal Code,” he said. The same legislation also paved the way for legalization of abortion.

The younger Trudeau’s move to the left hasn’t come at any political cost, as his post-election honeymoon with the electorate continues. A public opinion poll released this week by Forum Research showed Trudeau with a favorability rating of 57 percent.

Moreover, 52 percent of those surveyed said they would vote Liberal if an election were held now, compared with only 40 percent who opted for the party in October. Those figures would mean a massive landslide for Trudeau in the House of Commons under Canada’s parliamentary system.