BARCELONA (AFP) - A Moroccan imam believed to have radicalised youths who committed Spain's terror attacks was confirmed dead Monday (Aug 21) in an accidental explosion at the suspects' bomb factory, police said.

Asked whether Abdelbaki Es Satty had died in the blast on Wednesday that precipitated the attacks, Catalan police chief Josep Lluis Trapero said: "It is confirmed," adding "the remains of the imam were there", in the house in Alcanar that exploded.

The dead Moroccan imam has become a key target of the probe into Spain's twin terror attacks, suspected of having created the cell in a picturesque town near the Spanish Pyrenees that allegedly launched the deadly assaults last week.

Those who knew him described Abdelbaki Es Satty as a discreet and religious man, who had recently asked for a holiday from the mosque he was preaching in, apparently to return to Morocco for personal business.

But in fact, he was among those blown up in an accidental explosion Wednesday in the house where the suspected attackers were believed to be building bombs, police confirmed on Monday.

The blast likely changed the plans of the attackers, who instead used vehicles to smash into pedestrians on Barcelona's busy Las Ramblas boulevard and in the seaside resort town of Cambrils.

Related Story Spanish police track down, shoot dead Barcelona attacker

"On Tuesday morning, he left saying he was going on vacation to Morocco," said fruit-seller Nordeen El Haji, 45, who four months ago moved into the apartment that Satty occupied in Ripoll.

The decrepit two-room flat rented for 150 euros ($175) a month has a view of the tree-covered Pyrenees and the red roofs of the quaint Catalonian town, 90 kilometres (50 miles) north of Barcelona.

"He spoke little, spent time with his computer in his room, and had an old mobile phone with no internet, and few books," said Satty's flatmate.

On a piece of furniture lies the police search order dated Friday, just hours after the twin attacks that claimed 15 lives and wounded 120 people.

Police said the imam had been in prison from 2010-2014 for drug trafficking.

He had once been in contact with a suspect wanted on terrorism charges but was never himself charged with terror-related incidents.

As local media speculated on the influence of the imam on the young attackers, his flatmate said that in the last four months, he had not hosted any youths in the apartment.

"This imam was normal and ordinary in public," said Mohamed Akhayad, a 26-year-old Moroccan electrician-mechanic, who sometimes went to the prayer hall that opened in 2016 where he preached.

"If he ate up the brains of these youths, he must have done it secretly, in a secret place," he said at the main Moroccan cafe in town.

Another Moroccan, who did not want to give his name, described the imam as "very solitary, and hung out more with these youths than with people of his age".

The 43-year-old man said he knew the young suspects in the attacks, as he had organised football matches with them.

The imam "was always dressed in black", he said, adding: "We saw very little of him at the Moroccan cafe".

In Sant Pere street where the imam lived, a 64-year-old local, Francesc Gimeno, said the man "had a reputation of being very Islamist".

"He wanted all the Moroccans to think like him, putting religion above all," said Gimeno, saying he also "required Moroccan women in town to cover themselves".

But Hammou Minhaj, 30, a Moroccan and secretary of Ripoll's Muslim community, said: "He doesn't say that here at the mosque. Outside, I don't know." Satty arrived in Ripoll in 2015, said Minhaj.

- 'Knows the Koran better than us' - .

But then "he went to Belgium as imam, at least that's what he said, before returning to Ripoll," added Minhaj.

"He started as an imam in our new mosque in April 2016. What's important is that he knows the Koran better than we do." But at the end of June, the imam asked for three months' leave to go to Morocco on holiday, Minhaj said.

In Belgium, the mayor of the Vilvorde region told AFP that Satty spent time in the Brussels suburb of Machelen between January and March 2016.

Brussel's Molenbeek suburb - on the other side of the city - has gained notoriety as a hotbed of international jihadists after the March 2016 Brussels attacks and the November 2015 Paris assaults.

In the Moroccan town of M'rirt, relatives of the 22-year-old who police believe drove the van into crowds in Barcelona, Younes Abouyaaqoub, also accused the imam of radicalising the young man as well as his brother Houssein.

"Over the last two years, Younes and Houssein began to radicalise under the influence of this imam," their grandfather told AFP.

Police on Monday shot Younes dead in a village west of Barcelona.

A neighbour close to the Abouyaaquob family, speaking on condition of anonymity, said the imam "had recruited Moroccans of Ripoll and planned the attacks".

"He took leave from the mosque saying he had to return to Morocco to deal with inheritance problems.

"So another imam was found to replace him at the mosque, but a few days before the attacks, he was seen in Ripoll," added the source, who also has family in the small town.