LUXEMBOURG EU states agreed on Friday on tight laws against incitement to terrorism in order to clamp down on militant groups' use of the Internet.
EU justice and interior ministers also agreed in Luxembourg on an action plan to try to stop groups getting explosives.
Police say the Internet has taken on huge importance for militants, enabling them to share know-how, plan operations and spread propaganda to a mass audience.
"The Internet is used to inspire and mobilize local terrorists ... functioning as a virtual training camp," a text agreed by ministers said.
"Each member state shall take the necessary measures to ensure that terrorist-linked offences include ... public provocation to commit a terrorist offence, recruitment for terrorism, training for terrorism."
States may also consider attempts to train and recruit as terrorist offences, but are not obliged to do so, an EU official said.
Spain's secretary of state for justice, Julio Perez Hernandez, welcomed the move.
"The battle to anticipate (terrorist acts) is crucial for Spain," he told reporters. "One should not wait for smoke to know there is terrorism."
In an effort to assuage civil rights campaigners, the law says that the new measure may not be used to restrict freedom of expression and freedom of the press.
Before entering into force, the law still needs to be confirmed by ministers after a number of national parliaments have discussed it.
A European Commission official said countries like Spain and Italy already punish public provocation to terrorism but others, like Scandinavian countries, would have to change their legislation to apply the new EU text.
Under the plan to enhance the security of explosives, ministers agreed to establish an early-warning system on stolen explosives and detonators by the end of the year.
They also agreed to create by the year-end a "European Bomb Data System" that would give police and governments permanent access to information on incidents involving explosive devices.