Five times a day, a caretaker in a white knit prayer cap rolls a corrugated metal door over the side of the Al Furkan mosque in the Spanish village of Vilanova i la Geltru.
The metal muffles the muezzin's call to prayer so that it can't be heard across a scruffy industrial park and beyond, to beach resorts that line the glittering Mediterranean coast less than a mile away.
The green-and-white stucco warehouse-turned-mosque sits behind a padlocked 8-foot-high steel fence.
The unassuming space about 30 miles south of Barcelona is where Spanish police believe radicals planted the seed a dozen years ago for the kind of terrorist attack seen last month in Barcelona and Cambrils. The Islamic State extremist group claimed responsibility for a van attack on pedestrians in Barcelona and a knife attack in Cambrils, which together killed 16 people.
The suspects in the August attacks — 12 men in their late teens and early 20s, all of Moroccan origin — grew up about 95 miles north of the Al Furkan mosque in Ripoll, a tidy village of about 10,000 people in the foothills of the Pyrenees mountains.
But the suspects were not known as radicals or militants, authorities and local residents said. Instead, they were known as secular, beer-drinking young men.
"A week before the attacks, we were hanging out with them on this same square," Paula Lopez, 17, said recently, referring to the village square.
She pulled out her cellphone to show a photo of herself with one of the suspects at a school dance last year. They're beaming, their cheeks pressed together.
More than 200 Islamist terrorism suspects have been arrested in Spain since the country raised its terrorism alert level to 4, out of 5, in 2015, with most of the arrests occurring in northeastern Spain's Catalonia region.
"We've dismantled many terror cells already, always by acting on tips: Someone's behavior changes drastically, or they start posting extremist things online," Catalan police Inspector Albert Oliva said in an interview at regional police headquarters in Barcelona. "But none of those things happened here. This was not a textbook case. We have to go deeper."
There are 268 registered mosques in Catalonia, and police have relations with all of them, Oliva said. But they're looking more closely at the small number of ultraconservative Salafi mosques among them, and hiring Moroccan Arabic-speaking agents to go undercover in those, he said.
At the Al Furkan mosque, its president, Youssef Aghbalou, said a previous imam believed in Salafism.
"But he took it too far," Aghbalou said. "He radicalized people. Seventeen people from our mosque went to jail."
The 17 were part of an Al Qaeda cell broken up in 2005 by police investigating the Madrid train bombings a year earlier. Dozens of suspects were charged in those attacks, and an investigation of their associates led police to Al Furkan.
Its imam, Mohamed Mrabet, was convicted of recruiting suicide bombers to go to Iraq. When police went through his belongings, they found a pamphlet titled "Secrecy in Jihad," instructing radicals to go undercover by acting like nonobservant Muslims — drinking beer, eating pork, avoiding mosques.
The manual lays out the basic tenets of Takfir wal Hijra, a now-defunct Salafi extremist group that originated in Egypt in the 1970s.
"Takfir wal Hijra was the extreme fringe of jihadism. They basically advocated it's legitimate to act like non-pious Muslims — which includes drinking or smoking or dating — to hide their true intentions," said Lorenzo Vidino, director of the Program on Extremism at George Washington University, who has studied jihadism in Catalonia. "The group was wiped out by Egyptians a long time ago, but the mind-set has remained, and a lot of extremists use those tactics still today."
Police are looking into whether the 12 suspects in the Barcelona and Cambrils attacks may have been inspired by Takfir wal Hijra's philosophy.
The imam believed to have radicalized them, Abdelbaki Es Satty, also had links to the Al Furkan mosque. His identification was found in Mrabet's belongings in 2005. (Police wiretapped Es Satty's phone that year but say they found nothing suspicious.)
Though Islamic State suspects in Europe have overwhelmingly come from poor, segregated immigrant areas, the suspects in last month's attacks appeared to be well integrated.
In recent months, two of the suspects — brothers — had started wearing flashy clothes and bought a new car, said another childhood friend, Maria Garcia, 21. She thought maybe the money came from dealing drugs.
"But smoking pot isn't a sign of terrorism," Garcia said. "In fact, it's the opposite. People who are radicalized don't do drugs. They're religious. Our friends never went to the mosque. So we didn't think anything of it."
Spain's extremist threat is estimated to be smaller than that in France or Britain, but Islamists have been embedded along this stretch of Spain's northeast Mediterranean coast for a generation, according to academics who have studied Islamic extremism, as well as law enforcement officials. It began with the arrival from Morocco of a few Salafi imams, who espouse a conservative, but not necessarily violent, ideology.
"In the early 1990s you had a couple of very charismatic preachers that established the first Salafist mosques in southern Catalonia. From there they expanded, partially because of the funding they received from [Persian] Gulf countries," Vidino said. "They built a narrative which is fairly easy for a radical imam or a few young followers to take to the next level, which entails the use of violence."
The map of the southern Catalan coast is dotted with locations associated with terrorists. About 40 miles south of the Al Furkan mosque, Sept. 11 ringleader Mohamed Atta held an attack planning meeting in the town of Salou in July 2001. That's right next door to Cambrils, where attackers were cornered and killed by police last month. Farther south, in Alcanar, Es Satty died in what police believe was an accidental explosion the day before the attacks, as he built bombs out of gas canisters. On Friday, police arrested another man in Alcanar, allegedly for helping Es Satty stockpile explosives.
Aghbalou said the current administration at the Al Furkan mosque and the local community are focused on safety, not extremism.
"We've installed security cameras in our mosque, so we can spot anything out of the ordinary — any different behavior — and report it to police," Aghbalou said. "These days, you don't know what's inside people's heads. We want to keep ourselves and our children safe."
Frayer is a special correspondent.