Jose Luis Rodriguez Zapatero, who ordered Spanish troops out of Iraq immediately after taking office, on Friday called for a stronger United Nations role in establishing world order.
"Terrorism ... at this time is more violent and more indiscriminate and there is a clear risk of it spreading internationally if strong measures are not taken," the socialist party leader told a university forum on terrorism.
"The best way of defeating terrorism is by the practice of democracy," he said. "Not a single democratic norm should be sacrificed to defeat terrorism."
Without referring specifically to Iraq, Zapatero said recent military interventions aimed at fighting terrorism not only ran the risk of worsening the security situation but also called into question the basis of the international order.
EU response slow despite
Madrid blasts, says Zapatero
He said a "clash of cultures" between the West and Muslim nations would have disastrous consequences.
Zapatero's firm opposition to the Iraq invasion was in contrast to the position of his predecessor Jose Maria Aznar, a committed ally and personal friend of US President George Bush.
"Terrorism will be defeated," Zapatero told the crowd of students and reporters.
"But to do so requires a dialogue between civilisations, the United Nations to have more room to govern in the interests of international order, and also a better distribution of wealth in the world."
"The European Union has begun a process of implementing common policies on regulations and policing," but despite the September 11 attacks and the Madrid bombings, their application and efficacy is slow, he said.
"Not a single democratic norm should be sacrificed to defeat terrorism"
Jose Luis Rodriguez Zapatero,
prime minister, Spain
Zapatero won the Spanish election for prime minister three days after train bombings by suspected Islamists killed 191 people in Madrid.
He praised the tolerance of the Spanish people following the bombings and said their bravery in launching mass demonstrations against terrorism was a lesson to the world.