U.S. President Donald Trump joined other world leaders in sending his condolences to Canadians and condemning the "vicious attack" on a Quebec City mosque that left six men dead and several others in critical condition.

But Mr. Trump's spokesman later appeared to link the incident with the U.S. travel ban on seven Muslim-majority countries, despite the fact that the six male victims in the Quebec attack were Muslim.

White House Press Secretary Sean Spicer told reporters on Monday that Mr. Trump called Mr. Trudeau to offer his condolences and pledge his support to Canadian authorities.

Story continues below advertisement

Read more: One suspect in custody after six killed in 'terrorist attack' at Quebec mosque

Explainer: The Quebec City mosque attack: What we know so far

Related: Quebec City shooting was act of terror against Canada, Trudeau says

"The President offered his condolences as well as his thoughts and prayers to the victims and their [families] and to all Canadians. This is another senseless act of violence that cannot be tolerated," Mr. Spicer said.

"The President also pledged to support the Canadian police and intelligence service in any way necessary. Prime Minister Trudeau was extremely appreciative and he was also cautious to draw conclusions on the motives at this stage in the investigation and the President shared those thoughts."

Still, Mr. Spicer appeared to link the attack with Mr. Trump's executive order to halt all refugee admissions for 120 days, suspend the Syrian refugee program indefinitely and suspend residents of Syria, Iraq, Iran, Libya, Somalia, Sudan and Yemen from entering the U.S. for 90 days.

In the Quebec case, however, the victims were Muslim men and the suspect is Alexandre Bissonnette, a 27-year-old college student from the Quebec City suburb of Cap-Rouge known in activist circles as a right-wing troll who frequently took anti-foreigner and anti-feminist positions and stood up for Mr. Trump.

Story continues below advertisement

"We condemn this attack in the strongest possible terms. It's a terrible reminder of why we must remain vigilant, and why the President is taking steps to be proactive rather than reactive when it comes to our nation's safety and security," Mr. Spicer said.

When asked about Mr. Spicer's comments seemingly linking the U.S. immigration ban with the Quebec attack, Public Safety Minister Ralph Goodale said it was too early in the investigation to determine motivation.

"The fact of the matter is the investigation into these terrible tragic circumstances in Quebec is just beginning," Mr. Goodale told reporters.

"The police authorities are collecting all of the evidence to identify exactly who was involved and what was their motivation."

The Prime Minister's Office released a statement about Mr. Trump's phone call but did not expand on whether the two leaders discussed the immigration ban, which caused confusion and controversy around the world last weekend. Canadian officials said Sunday that Canadian dual citizens or permanent residents would not be affected.

Mr. Trudeau on Monday called the Quebec City shootings a "terrorist attack on Muslims" and planned to travel to the area later in the day, along with interim Conservative leader Rona Ambrose and NDP leader Tom Mulcair.

Story continues below advertisement

"Last night's horrible crime against the Muslim community was an act of terror committed against Canada and against all Canadians," Mr. Trudeau said.

German Chancellor Angela Merkel, French President François Hollande, Mexican President Enrique Pena Nieto, Australian Prime Minister Malcolm Turnbull, Pope Francis, and Russian President Vladimir Putin all condemned the attack.

Ms. Merkel called it "despicable," while Mr. Hollande said "France stands at the sides of the victims and their families;" Pope Francis conveyed his condolences in writing and in person to the archbishop of Quebec, Cardinal Gerald LaCroix; and Mr. Putin sent his condolences to Mr. Trudeau and the victims' families. "This murder of people who had gathered at a mosque to pray is staggering in its cruelty and cynicism," Mr. Putin wrote in a statement posted on the Kremlin website.

British Prime Minister Theresa May has not commented, but Howard Drake, the British High Commissioner to Canada, said in a tweet that the U.K. is "shocked and saddened" by the attack, and expressed his "deepest condolences to [the] great Quebec people" and Quebec Premier Philippe Couillard.

Mr. Pena Nieto on Twitter said Mexico stands in solidarity with Canada and the families of those who lost their lives, and condemned acts of violence that go against religious tolerance.

Mr. Turnbull also tweeted his support. "We stand in solidarity with Canada & condemn the attack on worshippers at a Quebec mosque – an assault on religious diversity."

Story continues below advertisement

In the House of Commons Monday, Mr. Trudeau thanked political and faith leaders from around the world who reached out since the attack.

"Your thoughts and condolences are greatly appreciated," Mr. Trudeau said.

In 2014, then-president Barack Obama called Stephen Harper after the shooting death of Cpl. Nathan Cirillo near Parliament Hill. Mr. Obama offered his condolences on behalf of the American people and condemned the attack as "outrageous," and said, "We're all shaken by it."

John Kerry, then the U.S. secretary of state, laid a wreath at Ottawa's War Memorial, where Mr. Cirillo was shot and killed, when he visited Ottawa almost a week later.

Others voicing support for the people of Quebec City include the Embassy of Turkey, organizers of the Women's March, New York City Mayor Bill de Blasio, and the city of Paris, where the Eiffel Tower will go dark at midnight to honour those who have lost their lives.

Elizabeth Moore Aubin, the Chargé d'Affaires at the U.S. embassy, also sent a message of condolence on Monday.

Story continues below advertisement

"On behalf of the U.S. Mission in Canada and the American people, I offer our deepest and most heartfelt condolences to the families of those who died in yesterday's unjustified attack at the Quebec Islamic Cultural Center in Quebec City and wish a speedy recovery to those injured in the shooting," she wrote.

"The United States is determined to fight terrorism and stands ready to assist the Canadian government as it deals with the aftermath of this tragic event."

Mr. Trump has yet to appoint a new U.S. ambassador to Canada following the resignation of former ambassador Bruce Heyman.

With a report from The Associated Press