QUEBEC -- A mass shooting that killed six men at a Quebec mosque is a grim reminder that hateful words seeking to exclude or demean others can have tragic consequences, Prime Minister Justin Trudeau told a funeral service Friday for three of the victims.

"It's high time those behind these messages -- whether they are politicians, radio or TV hosts or other public personalities -- realize the harm their words can cause," Trudeau said, prompting a wave of applause.

"Confronted with these words that hurt and exclude, it falls on us to defend the values that are important to us," he told several thousand mourners at the Quebec City convention centre.

"Every one of us is responsible for leading the fight against injustice and discrimination in daily life, for acting in a way that represents who we are, that represents Canada, that represents the country that Azzedine Soufiane, Mamadou Tanou Barry and Ibrahima Barry loved so much."

Trudeau said Mamadou Tanou Barry, 42, Ibrahima Barry, 39, and Soufiane, 57, were extraordinary men who loved their families, their communities and their faith.

The Barry men were from Guinea, while Soufiane came from Morocco.

The ceremony came a day after a similar service in Montreal for Abdelkrim Hassane, 41, Khaled Belkacemi, 60, and Aboubaker Thabti, 44, the three other people shot to death in the carnage.

Hussein Guillet, an imam, said it is important to build on the tragedy.

"God gave us a lemon, let's make lemonade out of that," he told mourners Friday. "Let us build on this negative and then have something positive."

Quebec Premier Philippe Couillard and Quebec City Mayor Regis Labeaume also addressed the audience, with the latter striking a particularly emotional chord when he told Soufiane's adolescent son, "We love you."

Labeaume also announced the Muslim community in the city will get the cemetery it has been asking for.

Couillard, who opened his speech in Arabic, echoed Trudeau's message on the importance of dialogue in the wake of the tragedy.

"A lot has been said, a lot has been heard, and hopefully a lot has been understood," he said.

Couillard made a point of using several Arabic phrases, including "Allahu akbar," which means "God is great" and which the premier said is often falsely associated with violence and terrorism.

The six victims were killed when a gunman stormed the mosque and opened fire on men who were attending prayer. Authorities have refused to specify what type of firearm was used in the mass shooting.

On his way into Friday's service, Trudeau told reporters it is important to remember the lives "taken from us so brutally in the terrorist attack last Sunday."

"Over the past week we have been reminded multiple times of the warmth, of the strength, of the unity of Canadians," he said. "And we've seen the silent majority of people who are good and welcoming and open to one another is choosing to be less and less silent."

Alexandre Bissonnette, 27, was arrested Sunday night following the massacre in which 19 people were also wounded.

Bissonnette has been charged with six counts of first-degree murder and five of attempted murder using a restricted firearm.