WASHINGTON -- U.S. President Donald Trump is threatening to veto a defence policy bill unless it ends protections for internet companies that shield them from being held liable for material posted by their users.

On Twitter Tuesday night, Trump took aim at Section 230 of the 1996 Communications Decency Act, which protects companies that can host trillions of messages from being sued into oblivion by anyone who feels wronged by something someone else has posted -- whether their complaint is legitimate or not.

Trump called Section 230 "a serious threat to our National Security & Election Integrity," adding, "Therefore, if the very dangerous & unfair Section 230 is not completely terminated as part of the National Defence Authorization Act (NDAA), I will be forced to unequivocally VETO the Bill."

Trump has been waging war against social media companies for months, claiming they are biased against conservative voices.

In October he signed an executive order directing executive branch agencies to ask independent rule-making agencies, including the Federal Communications Commission and the Federal Trade Commission, to study whether they can place new regulations on the companies.

Since losing the presidential election, Trump has flooded social media with unsubstantiated claims of voter fraud. Twitter has tagged many such Trump tweets with the advisory, "This claim about election fraud is disputed."

Tuesday's veto threat is another potential roadblock for the passage of the annual defence policy measure, which is already being held up in Congress by a spat over military bases named for Confederate officers. The measure, which has passed for 59 years in a row on a bipartisan basis, guides Pentagon policy and cements decisions about troop levels, new weapons systems and military readiness, military personnel policy and other military goals.