Social media platforms such as Facebook and Twitter will be forced to take terrorist content off their sites within an hour or face multimillion-pound fines under EU proposals.

Julian King, the British security commissioner in Brussels, said there had been a shift in the nature of terror attacks, with people being increasingly radicalised and then receiving instructions online. He said digital material played a part in every attack in European in the past 18 months.

A voluntary code of conduct on the removal of terrorist content had not been taken up widely enough and it was vital those who failed to act to clean up their sites received a “big sting”, King said in an interview with the Guardian.

The European commission is proposing legislation to ensure all member states bring in sanctions against those who repeatedly fail to respond to the new removal orders within an hour of them being issued, with platforms facing penalties of up to 4% of their global revenue.

The commission believes the legislation will come into statute across the EU in 2019 during the UK’s 21-month transition period after Brexit, meaning it will become part of British law.

King said: “We have got a problem with content; it is not an entirely new problem, we are not starting from scratch, we have agreed to do some voluntary stuff, and we got some good progress – but not enough.

“And the shift in the nature of the attacks – so we have got more locals self-radicalised – just underlines again the importance of tackling all the different ways in which people become radicalised.”

The commissioner, a former British ambassador to France, added: “Every attack over the last 18 months or two years or so has got an online dimension. Either inciting or in some cases instructing, providing instruction, or glorifying.

“So this online radicalisation circle is one that we want to break. That is why we are going to take for the first time the step of proposing legislation that puts obligations directly on the platforms.

“This is the stuff that needs to be done, and it will be all platforms in Europe, wherever they are based. We need to do it because we just haven’t gone far enough, fast enough, with enough platforms.”

Under the legislation, the EU would also require platforms to put in place automated systems to remove terrorist content, should it be proven they are being manipulated by proscribed groups.

Member states would also have to establish dedicated teams to enforce the removal orders. It is understood that countries outside the EU, including Israel, have shown interest in emulating the proposals.

The attempt to deal with online terrorist content is one of series of security initiatives being brought forward this year.

Anxiety is increasingly being voiced in Brussels about the potential for the European elections next year to be targeted by external forces that wish to influence the results.

A code of conduct is being drawn up that will recommend member states seek more transparency from social media platforms about those micro-targeting individuals with messages and news. The code is currently due to be voluntary, but King said the commission would review its effectiveness and a legislative solution was not out of bounds.

“I hope it will have some strong recommendations, that the platforms will be asked to meet on greater transparency of funding of political advertising, sponsored content, stopping content being circulated by mechanical means rather than human beings,” he said.

“I think it is really important that the platforms step up to their responsibility in this area. And we have shown where there is enough concern, if the voluntary approach can’t work then we don’t rule out going further.”

Following the Cambridge Analytica scandal, in which the personally identifiable information of 87 million Facebook users was found to have been misused for political gain in the Brexit vote, European political groups and foundations will also face tougher regulation.

Parties could be fined up to 5% of their annual budgets for breaching data protection rules in order to deliberately influence the outcome of the European elections, including those for the European parliament in May 2019.

King said: “We have a series of elections coming up. We don’t know that they are going to be targeted. I don’t have intelligence that they are going to be targeted. But given the track record, there has to be a chance, and we have to up our game and be more resilient.”