Image copyright PA

Social media companies have been told to "clean up their platforms" or be prepared to face the "force of the law" by Home Secretary Sajid Javid.

The warning comes after a gunman who killed 49 people at two mosques in New Zealand filmed the attack and live-streamed it directly to Facebook.

Writing in the Daily Express, Mr Javid said: "Tech companies must do more to stop his messages being broadcast."

The live-stream of the attack on Facebook lasted for 17 minutes.

Despite the original video being taken down, it was quickly replicated and shared widely on other platforms, including YouTube and Twitter.

Mr Javid urged people to stop viewing and sharing the "sick material" online, adding: "It is wrong and it is illegal.

"Online platforms have a responsibility not to do the terrorists' work for them.

"This terrorist filmed his shooting with the intention of spreading his ideology."

He added that the government was trying to address this type of "illegal" behaviour.

The government is due to publish a delayed White Paper on "online harms" in the coming weeks.

The gunman, who live-streamed the attacks on Friday from a head-mounted camera, identified himself as Brenton Tarrant in the footage, which showed him shooting at men, women and children.

Image copyright Reuters Image caption Brenton Tarrant, 28, appeared in court on Saturday in relation to the mosque attacks

All of the social media firms sent messages of sympathy to the victims of the mass shootings, reiterating that they act quickly to remove inappropriate content.

Facebook said: "New Zealand Police alerted us to a video on Facebook shortly after the live-stream commenced and we removed both the shooter's Facebook account and the video."

Mr Javid responded to a YouTube tweet which said it was "working vigilantly" to remove any violent footage by saying that the digital companies needed to "take some ownership".

The attacks in Christchurch happened as people were attending the mosques for prayers.

Mr Javid said he had been left "sick to the stomach by the massacre of 49 innocent worshippers".

He wrote: "They were simply targeted for being Muslims, as they paid respects to God.

"My own late father never missed Friday prayers. I often joined him, and I fondly look back on the peaceful moments we shared."

Vigils for the victims took place in the UK on Friday, amid an outpouring of support for Britain's Muslim community.

Media playback is unsupported on your device Media caption London imam Mohammed Mahmoud calls for a crackdown on far-right extremism

Britain's most senior Jewish faith leader Chief Rabbi Mirvis offered his condolences, and said the attacks were "terrorism of the most despicable kind, callously planned and motivated by the scourge of Islamophobia".

Prime Minister Theresa May offered the UK's "deepest condolences" after the "horrifying terrorist attack".

Police have increased patrols at British mosques to provide reassurance.