BBC world affairs correspondent, in Madrid
A sheet behind the altar showed a black ribbon of mourning
World leaders have attended an often highly emotional state memorial service in Madrid for the nearly 200 victims of the 11 March train bombings.
Some 1,800 were injured.
On the sidelines, US Secretary of State Colin Powell, British Prime Minister Tony Blair and other leaders held talks with the incoming Spanish Prime Minister, Jose Luis Rodriguez Zapatero.
Mr Zapatero has been strongly critical of the Iraq war.
It was the first state funeral service of its kind in Spain for anyone outside the royal family since the end of the Franco era in 1975.
Several hundred relatives of the victims of the train bombings were in Almudena Cathedral, which joins the official royal palace in the centre of Madrid.
As those government leaders who attended the service tried to forge a tougher and more united stand against terrorism after these bombings, the Archbishop of Madrid, Cardinal Antonia Rouco Varela, spoke of terrorism as a strategy of hatred and murder.
But he said the response was to bring love where it did not exist - that was the way to peace.
There was an angry outburst from one member of the congregation as the outgoing Spanish Prime Minister, Jose Maria Aznar, took his seat.
Otherwise the atmosphere was dignified and often deeply emotional - not just for the victims' relatives, many of whom wept openly and bowed their heads, but for King Juan Carlos and Queen Sofia, too.
At the end of the service, they walked among the relatives, consoling them, and were visibly moved themselves.
Representatives of several other European royal families had come to offer their support to a nation that still mourns.
At several places in Madrid, large screens had been erected relaying the service.
Hundreds stood and watched.
Ahead of the service, Mr Zapatero spoke for nearly an hour with Tony Blair.
This was against the background of his clear differences with Britain, the US and the outgoing Spanish government over Iraq.
He has criticised the motives for going to war against Saddam Hussein and threatened to pull out Spanish troops from Iraq.
Afterwards, British sources said the meeting had been warm and friendly, and indicated it had not been dominated by Iraq but covered a wider range of issues, including economic reform and education.
The Spanish side, though, made clear that on Iraq, that the United Nations should play a more central role.
After the service, a string of further meetings included one with the US secretary of state, where it can be presumed that Mr Zapatero again pressed the UN cause and was again been asked to reconsider withdrawing Spanish troops.
Clearly easier territory was Mr Zapatero's meeting with President Jacques Chirac of France - Europe's arch opponent of the Iraq war.
French diplomatic sources later said they looked forward to developing a strong relationship, not least in fighting terrorism.
In deference, presumably, to the purpose of all the leaders being in Madrid today, it turned out not to be a day for political grand-standing.