A US judge has tossed out a lawsuit accusing Twitter of abetting terrorism by allowing Islamic State (IS) propaganda to be broadcast using the messaging platform.

District Court Judge William Orrick granted a motion by Twitter to dismiss the case, reasoning that providing a platform for speech is within the law and that the company did not create the content.

The Communications Decency Act protects online platforms from being held responsible for what users post.

The suit was filed in San Francisco federal court by the families of two government contractors killed late last year while working at a police training centre run by the United States in Amman, according to court documents.

A Jordanian police captain studying at the centre shot the two men to death, and IS militants later claimed the captain was a "lone wolf" working for the group's cause, the judge recounted in his ruling.

"As horrific as these deaths were, under the CDA Twitter cannot be treated as a publisher or speaker of ISIS's hateful rhetoric and is not liable under the facts alleged," Judge Orrick said in the decision.

The suit accused Twitter of providing "material support" to by letting accounts spread the message of the extremist group.

The judge left open the option of refiling an amended version of the suit.

AFP