Suspects in the Spanish terror attack investigation have admitted a bigger attack was planned and blamed a dead imam for the outrage, according to court sources.

Appearing in court for the first time, Mohamed Houli Chemlal, said the Islamist terror cell was planning to use homemade explosives to kill hundreds more people at landmarks in the city, including the historic Sagrada Familia cathedral.

A total of 15 people were killed in two vehicle ramming attacks and a car-jacking in Catalonia last week, and 130 were injured. Police now believe all the attack suspects have either been killed or captured.

Chemlal, 21 and Driss Oukabir, 27, both appeared for hearings in Spain’s High Court on Tuesday, though Oukabir denied involvement in the atrocity.

Spanish swimmer stays in his blocks in tribute to Barcelona attack victims

Two other suspects also appeared in court: Sahal el Karib, 34, and Mohammed Aalla, 27. All hearings took place behind closed doors in line with Spanish law.

Prosecutors had asked for the four to be sent to prison without bail on preliminary charges of being part of a terrorist organisation, homicide, causing havoc and dealing with explosives.

But on Monday evening, a judge ordered two of the four surviving suspects to be held without bail, another to be detained for 72 more hours and one freed.

National Court Judge Fernando Andreu said there was enough evidence to hold Chemlal and Oukabir on preliminary charges of causing homicides and injuries of a terrorist nature and of belonging to a terror organisation.

Sahl El Karib, the owner of a cybercafe in Ripoll, the Pyrenees hometown to most of the members of the cell, will remain in custody under arrest for at least 72 more hours while police inquiries continue.

The judged ruled the evidence to keep holding suspect Mohamed Aalla, whose car was used in the Cambrils attack, was "not solid enough", and he will be freed.

Chemlal was the first suspect to testify and admitted in court that the group planned a bigger attack using explosives against Barcelona’s monuments at the height of the summer tourist season, sources said. He is the only suspect to have conceded being part of the cell.

The terrorists’ broader plans are believed to have failed after a stockpile of gas canisters, to be used in an attack, blew up their safe house in Alcanar.

Imam Abdelbaki Es Satty, 45, is believed to have been killed in the accidental explosion.

He was accused by two unnamed suspects of organising the plot and wanted to blow himself up in the attack, Chemlal said, according to a court official.

Satty is suspected of having radicalised the terror cell responsible for the outrages.

Chemlal survived the explosion and was arrested in Alcanar, 120 miles south of Barcelona, a day before the ramming attacks.

Traces of a high explosive, triacetone triperoxide, were said to have been found in the house, along with the remains of two bodies and Isis documents, according to Judge Andreu. The same substance was used in suicide bombings in Manchester, Brussels and Paris.

Driss Oukabir, 27, who was the first suspect named in the hours after Thursday’s attack, also appeared in a closed session in court and denied being part of the terrorist cell. In a break from his original story, he admitted renting the vans used in the attacks but said he thought they were going to be used for a house move, according to a source speaking with AP. Oukabir, who was arrested in the town of Ripoll, said he changed his initial story out of fear.

Barcelona Attack Show all 30 1 /30 Barcelona Attack Barcelona Attack Police officers patrol on Las Ramblas following yesterday's terrorist attack, on August 18, 2017 in Barcelona, Spain. Thirteen people were killed and dozens injured when a van hit crowds in the Las Ramblas area of Barcelona on Thursday. Spanish police have also killed five suspected terrorists in the town of Cambrils to stop a second terrorist attack Getty Images Barcelona Attack Tourists and locals walk along Las Ramblas following yesterday's terrorist attack, on August 18, 2017 in Barcelona, Spain. Thirteen people were killed and dozens injured when a van hit crowds in the Las Ramblas area of Barcelona on Thursday. Spanish police have also killed five suspected terrorists in the town of Cambrils to stop a second terrorist attack. Getty Images Barcelona Attack Police officers patrol on Las Ramblas following yesterday's terrorist attack, on August 18, 2017 in Barcelona, Spain. Thirteen people were killed and dozens injured when a van hit crowds in the Las Ramblas area of Barcelona on Thursday. Spanish police have also killed five suspected terrorists in the town of Cambrils to stop a second terrorist attack. Getty Images Barcelona Attack People leave a fastfood with hands up as asked by policemen after a van ploughed into the crowd, killing two persons and injuring several others on the Rambla in Barcelona on August 17, 2017. A driver deliberately rammed a van into a crowd on Barcelona's most popular street on August 17, 2017 killing at least two people before fleeing to a nearby bar, police said. Officers in Spain's second-largest city said the ramming on Las Ramblas was a "terrorist attack" and a police source said one suspect had left the scene and was "holed up in a bar". The police source said they were hunting for a total of two suspects AFP/Getty Barcelona Attack Police officers tell members of the public to leave the scene in a street in Barcelona, Spain, Thursday, Aug. 17, 2017. Police in the northern Spanish city of Barcelona say a white van has jumped the sidewalk in the city's historic Las Ramblas district, injuring several people. AP Barcelona Attack Injured people react after a van crashed into pedestrians in Las Ramblas, downtown Barcelona, Spain, 17 August 2017. According to initial reports a van crashed into a crowd in Barcelona's famous Placa Catalunya square at Las Ramblas area injuring several. Local media report the van driver ran away, metro and train stations were closed. The number of people injured and the reasons behind the incident are not yet known. Official sources have not confirmed that the incident is a terrorist attack. EPA Barcelona Attack People flee the scene in Barcelona, Spain, Thursday, Aug. 17, 2017 after a white van jumped the sidewalk in the historic Las Ramblas district, crashing into a summer crowd of residents and tourists and injuring several people, police said. (AP Photo/Giannis Papanikos) AP Barcelona Attack People are pictured inside Systemaction, a locked down store after a van crashed into crowds on Las Ramblas in Barcelona, Spain, August 17, 2017. Courtesy Abbie Yermus/Handout via REUTERS ATTENTION EDITORS - THIS IMAGE WAS PROVIDED BY A THIRD PARTY. REUTERS Barcelona Attack People take shelter inside a shop in Barcelona, Spain, Thursday, Aug. 17, 2017. A white van jumped up onto a sidewalk and sped down a pedestrian zone Thursday in Barcelona's historic Las Ramblas district, swerving from side to side as it plowed into tourists and residents. Police said 13 people were killed and more than 50 wounded in what they called a terror attack. (AP Photo/Manu Fernandez) AP Barcelona Attack People move from the scene after a van crashed into pedestrians near the Las Ramblas avenue Reuters Barcelona Attack A policeman stands next to an ambulance after a van ploughed into the crowd, injuring several persons on the Rambla in Barcelona AFP/Getty Images Barcelona Attack People are evacuated from a street after a van crashed into pedestrians near the Las Ramblas avenue in central Barcelona, Spain, August 17, 2017. REUTERS/Stringer NO RESALES. NO ARCHIVE. Reuters Barcelona Attack Firefighters stands outside an evacuated mall after a van ploughed into the crowd, injuring several persons on the Rambla in Barcelona AFP/Getty Images Barcelona Attack Policemen stand next to vehicles in a cordoned off area after a van ploughed into the crowd, injuring several persons on the Rambla in Barcelona AFP/Getty Images Barcelona Attack Plain-clothes policemen phone as they walk past police cars in a cordoned off area after a van ploughed into the crowd, injuring several persons on the Rambla in Barcelona AFP/Getty Images Barcelona Attack A policemen and a medical staff member stand past police cars and an ambulance in a cordoned off area after a van ploughed into the crowd, injuring several persons on the Rambla in Barcelona AFP/Getty Images Barcelona Attack A person is stretched out of a mall by medical staff members in a cordoned off area after a van ploughed into the crowd, injuring several persons on the Rambla in Barcelona on August 17, 2017. Police in Barcelona said they were dealing with a "terrorist attack" after a vehicle ploughed into a crowd of pedestrians on the city's famous Las Ramblas boulevard on August 17, 2017. Police were clearing the area after the incident, which has left a number of people injured. AFP/Getty Images Barcelona Attack Children, some in tears, are escorted down a road in Barcelona, Spain, Thursday, Aug. 17, 2017. Police in Barcelona say a white van has mounted a sidewalk, struck several people in the city's Las Ramblas district. AP Barcelona Attack Mossos d'Esquadra Police officers and emergency service workers move an injured man, after a van crashes into pedestrians in Las Ramblas, downtown Barcelona, Spain, 17 August 2017. According to initial reports a van crashed into a crowd in Barcelona's famous Placa Catalunya square at Las Ramblas area injuring several. Local media report the van driver ran away, metro and train stations were closed. The number of people injured and the reasons behind the incident are not yet known. Official sources have not confirmed that the incident is a terrorist attack. EPA Barcelona Attack Mossos d'Esquadra Police officers attend injured people after a van crashed into pedestrians in Las Ramblas, downtown Barcelona, Spain, 17 August 2017. According to initial reports a van crashed into a crowd in Barcelona's famous Placa Catalunya square at Las Ramblas area injuring several. Local media report the van driver ran away, metro and train stations were closed. The number of people injured and the reasons behind the incident are not yet known. Official sources have not confirmed that the incident is a terrorist attack. EPA Barcelona Attack Injured people react after a van crashed into pedestrians in Las Ramblas, downtown Barcelona, Spain, 17 August 2017. According to initial reports a van crashed into a crowd in Barcelona's famous Placa Catalunya square at Las Ramblas area injuring several. Local media report the van driver ran away, metro and train stations were closed. The number of people injured and the reasons behind the incident are not yet known. Official sources have not confirmed that the incident is a terrorist attack. EPA Barcelona Attack A police officer cordon off a street in Barcelona, Spain, Thursday, Aug. 17, 2017. Police in the northern Spanish city of Barcelona say a white van has jumped the sidewalk in the city's historic Las Ramblas district, injuring several people. AP Barcelona Attack TOPSHOT - Policemen check the area after towing away the van which ploughed into the crowd, killing at least 13 people and injuring around 100 others on the Rambla in Barcelona, on August 18, 2017. A driver deliberately rammed a van into a crowd on Barcelona's most popular street on August 17, 2017 killing at least 13 people before fleeing to a nearby bar, police said. Officers in Spain's second-largest city said the ramming on Las Ramblas was a "terrorist attack". The driver of a van that mowed into a packed street in Barcelona is still on the run, Spanish police said. / AFP PHOTO / Josep LAGOJOSEP LAGO/AFP/Getty Images AFP/Getty Images Barcelona Attack TOPSHOT - Armed policemen stand in a cordoned off area after a van ploughed into the crowd, injuring several persons on the Rambla in Barcelona on August 17, 2017. Police in Barcelona said they were dealing with a "terrorist attack" after a vehicle ploughed into a crowd of pedestrians on the city's famous Las Ramblas boulevard on August 17, 2017. Police were clearing the area after the incident, which has left a number of people injured. / AFP PHOTO / Josep LAGOJOSEP LAGO/AFP/Getty Images AFP/Getty Barcelona Attack A man displays flowers at the Canaletas fountain on the Rambla boulevard on August 18, 2017, a day after a van ploughed into the crowd, killing 13 persons and injuring over 100 on the Rambla in Barcelona. Drivers have ploughed on August 17, 2017 into pedestrians in two quick-succession, separate attacks in Barcelona and another popular Spanish seaside city, leaving 13 people dead and injuring more than 100 others. In the first incident, which was claimed by the Islamic State group, a white van sped into a street packed full of tourists in central Barcelona on Thursday afternoon, knocking people out of the way and killing 13 in a scene of chaos and horror. Some eight hours later in Cambrils, a city 120 kilometres south of Barcelona, an Audi A3 car rammed into pedestrians, injuring six civilians -- one of them critical -- and a police officer, authorities said. / AFP PHOTO / Josep LAGOJOSEP LAGO/AFP/Getty Images AFP/Getty Images Barcelona Attack TOPSHOT - The van who ploughed into the crowd, killing at least 13 people and injuring around 100 others is towed away from the Rambla in Barcelona on August 18, 2017. A driver deliberately rammed a van into a crowd on Barcelona's most popular street on August 17, 2017 killing at least 13 people before fleeing to a nearby bar, police said. Officers in Spain's second-largest city said the ramming on Las Ramblas was a "terrorist attack". The driver of a van that mowed into a packed street in Barcelona is still on the run, Spanish police said. / AFP PHOTO / Josep LAGOJOSEP LAGO/AFP/Getty Images AFP/Getty Barcelona Attack TOPSHOT - Forensic policemen arrive in the cordoned off area after a van ploughed into the crowd, killing 13 persons and injuring over 80 on the Rambla in Barcelona on August 17, 2017. A driver deliberately rammed a van into a crowd on Barcelona's most popular street on August 17, 2017 killing at least 13 people before fleeing to a nearby bar, police said. Officers in Spain's second-largest city said the ramming on Las Ramblas was a "terrorist attack". / AFP PHOTO / Josep LAGOJOSEP LAGO/AFP/Getty Images AFP/Getty Images Barcelona Attack TOPSHOT - A person is helped by Spanish policemen and two men after a van ploughed into the crowd, killing at least 13 people and injuring around 100 others on the Rambla in Barcelona on August 17, 2017. A driver deliberately rammed a van into a crowd on Barcelona's most popular street on August 17, 2017 killing at least 13 people before fleeing to a nearby bar, police said. Officers in Spain's second-largest city said the ramming on Las Ramblas was a "terrorist attack". The driver of a van that mowed into a packed street in Barcelona is still on the run, Spanish police said. / AFP PHOTO / Nicolas CARVALHO OCHOANICOLAS CARVALHO OCHOA/AFP/Getty Images AFP/Getty Images Barcelona Attack TOPSHOT - Policemen accompany clients of a store outside a cordoned off off area after a van ploughed into the crowd, killing 13 persons and injuring over 80 on the Rambla in Barcelona on August 17, 2017. A driver deliberately rammed a van into a crowd on Barcelona's most popular street on August 17, 2017 killing at least 13 people before fleeing to a nearby bar, police said. Officers in Spain's second-largest city said the ramming on Las Ramblas was a "terrorist attack". / AFP PHOTO / LLUIS GENELLUIS GENE/AFP/Getty Images AFP/Getty Images Barcelona Attack TOPSHOT - Forensic policemen arrive in the cordoned off area after a van ploughed into the crowd, killing at least 13 people and injuring around 100 others on the Rambla in Barcelona. A driver deliberately rammed a van into a crowd on Barcelona's most popular street on August 17, 2017 killing at least 13 people before fleeing to a nearby bar, police said. Officers in Spain's second-largest city said the ramming on Las Ramblas was a "terrorist attack". The driver of a van that mowed into a packed street in Barcelona is still on the run, Spanish police said. / AFP PHOTO / PAU BARRENAPAU BARRENA/AFP/Getty Images AFP/Getty Images

He previously claimed his documents were stolen by his 17-year-old brother, Moussa, to rent the vehicle which killed 13 people in the busy Las Ramblas district. The alleged driver of the van, Younes Abouyaaqoub, 22, remained at large for four days before being shot by police in the town of Subirats yesterday.

Moussa was among five other suspects killed by police after attempting a second vehicle ramming in the coastal town of Cambrils hours after the atrocity in Barcelona, which left one woman dead. The other dead men were named as Said Aalla, 18, Houssaine Abouyaaqoub, 19, Omar Hychami, 21 and Mohamed Hychami, 24.

The suspects bought knives and an axe just minutes before the rampage, court documents showed.

Also on Tuesday, the French Interior Minister Gerard Collomb revealed the Audi car used in the Cambrils attack was photographed in Paris some time before the attack.

Mr Collomb said: “This group came to Paris but it was a quick arrival and departure.”

The significance of the France visit is not yet known but the cell is believed to have been exclusively Spanish.