Canadian prime minister Justin Trudeau announced legislation on Monday to protect transgender people from hate speech and discrimination, as debate rages in the United States over laws restricting their rights.

"Even today, despite all the obstacles we have overcome, the battles we have won, and the victories we have celebrated, we are still witnesses, and in some cases, victims of injustices," Mr Trudeau said in a speech at a Montreal event hosted by gay rights group Fondation Emergence.

The recently elected Liberal prime minister said legislation ensuring "the full protection" of transgender Canadians is to be officially unveiled by Justice Minister Jody Wilson-Raybould on Tuesday, the International Day Against Homophobia, Transphobia and Biphobia.

"We must continue to demand true equality," Mr Trudeau said in Montreal.

"We must carry on the legacy of those who fought for justice by being bold and ambitious in our actions, and we must work diligently to close the gap between our principles and our reality."