The office of the Canadian prime minister Justin Trudeau has forced Fox News to apologise and retract a “false and misleading” tweet that inaccurately described the suspect in the Québec City mosque shooting as a man of Moroccan origin.

Kate Purchase, the director of communications for the prime minister’s office, sent a letter to Fox News objecting to misinformation it had put out after the attack on the Québec City Islamic cultural center.

Shortly after the attack police arrested two men. Police did not release their names, but local media cited police sources to identify them as a French Canadian and a Moroccan-born Quebecer. By midday on Monday, police had clarified that only one was a suspect, and they had released the other – who was now being treated as a witness – without charge.

Fox News later sent out a tweet on Monday afternoon – shortly after the police clarification – suggesting there was just one suspect in the attack who was of Moroccan origin.

“These tweets by Fox News dishonour the memory of the six victims and their families by spreading misinformation, playing identity politics and perpetuating fear and division within our communities,” she wrote.

The letter continued: “We need to remain focused on keeping our communities safe and united instead of trying to build walls and scapegoat communities. To paint terrorists with a broad brush that extends to all Muslims is not just ignorant – it is irresponsible.

Man wrongly arrested over Berlin attack says he fears for his life

Read more

“If we allow individuals and organizations to succeed by scaring people, we do not actually end up any safer,” she added. “Fear does not make us safer. It makes us weaker. Ramping up fear and closing our borders is not a solution.”

Within hours, Fox News apologised for the error. “FoxNews.com initially corrected the misreported information with a tweet and an update to the story on Monday. The earlier tweets have now been deleted,” Refet Kaplan, the managing director at FoxNews.com, said in a statement. “We regret the error.”

Moroccan-born Quebecer Mohamed Belkhadir has described how he spent the night in custody after a misunderstanding.

He said he had been clearing snow off the steps outside the mosque when he heard gunshots. When the noise stopped, he called 911 and entered the mosque, he said: “It was a reflex. You can’t leave people when they’re in need.”

He said he was giving first aid to a friend when he caught a glimpse of a man with a gun. “I didn’t know it was a police officer – I thought it was the gunman who had returned.”

Belkhadir said he bolted from the scene. Only when police ordered him to the ground did he realise what was going on. He was released hours later, but by then his identity had become synonymous with the attacks.