During Friday prayers, Housam Khoja spoke in Arabic and Spanish so that everybody could understand his condemnation. The Islamic State group has claimed responsibility for the attacks that killed 15 people.
After Friday's ceremony in the Spanish capital, the director of the Islamic Cultural Center, Sami El Mushtawi, insisted that Islam is a peaceful religion and apologized for the acts of a few Muslims. He also pleaded for tolerance, saying that in recent days Muslims have been assaulted in Madrid, Granada and elsewhere.
Spain had almost 2 million Muslim residents at the end of last year, most of them Spaniards.
Spanish Prime Minister Mariano Rajoy says he will propose new measures to improve the European Union's coordination in fighting terrorism at a meeting next week.
Rajoy will join the leaders of Germany and Italy Monday at a meeting hosted by French President Emmanuel Macron in Paris. He gave no details of the proposals he will make.
Rajoy stressed Friday that political unity, police coordination and international cooperation are "the most important tools to defeat terrorists" and said that his government is ready to change laws "in order to fight the new forms of jihadi terrorism."
The Islamic State group has claimed responsibility for the attacks in Spain's northeastern Catalonia region last week that killed 15 people.
Prime Minister Mariano Rajoy has dismissed criticism of the coordination between Spanish national authorities and those in the widely self-governed Catalonia region before, during and after the attacks that killed 15 people last week.
The probe into the Aug. 17-18 attacks in Barcelona and Cambrils has suggested that ties of the alleged cell leader to other extremist cells and a criminal record for drug trafficking may have been missed because Catalan regional police didn't have information that was in the hands of central authorities.
Rajoy told reporters Friday that "the coordination has been fluid and constant, both at the political decision level and at the technical level of police responsibilities."
Barcelona's mayor Ada Colau has urged citizens to join a "massive rally" on Saturday to show their wholehearted rejection of violence.
Following a week dominated by the response to the deadly attacks in and near Barcelona, Colau told reporters she wanted the "streets of Barcelona to be overflown by people."
The march will follow the "No Tinc Por" slogan, which means "I'm not afraid" in the local Catalan language. That message has become a unifying response for locals in the aftermath of the attacks that left 15 dead in Aug. 17-18.
Taxi drivers, emergency workers and ordinary citizens who helped in the early hours will head the march, followed by authorities, Colau said.
King Felipe VI, Prime Minister Mariano Rajoy and national and regional politicians have announced plans to join the march.
Catalan lawmakers have unanimously condemned last week's attacks in and around Barcelona, holding a minute of silence at a special meeting of the regional parliament.
Speaker Carme Forcadell on Friday read a declaration signed by all political parties. She said citizens responded to the "brutal attacks" by showing the "maturity to distinguish between the spurious use of religions as a source of violent extremism and the peaceful coexistence among different religious identities."
Regional president Carles Puigdemont, Barcelona mayor Ada Colau and diplomats joined lawmakers in a minute of silence.
The Islamic State group has claimed responsibility for the attacks on Aug. 17-18 in Barcelona and Cambrils that left 15 dead and more than 120 injured. Eight suspects are dead and four more under investigation, two of them in jail.