A judge ordered two of the four surviving suspects in the extremist attacks in Spain held without bail, another detained for 72 more hours and one freed with restrictions Tuesday after the men appeared in court to answer questions about the events that killed 15 people.

National Court Judge Fernando Andreu issued his orders after quizzing the four about the vehicle attacks in Barcelona and Cambrils, as well as about the fatal explosion at a bomb-making workshop that police said scuttled the group's plot to carry out a more deadly attack at unspecified Barcelona monuments.

The judge said there was enough evidence to hold Mohamed Houli Chemlal, 21, and Driss Oukabir, 28, on preliminary charges of causing homicides and injuries of a terrorist nature and of belonging to a terrorism organization. Houli Chemlal also has an additional charge of dealing with explosives.

Owner of car used in Cambrils attack released

However, the judge ruled the evidence was "not solid enough" to keep holding suspect Mohamed Aallaa, who was freed on the conditions he appear in court weekly, relinquish his passport and not leave Spain. He owned the car used in the Cambrils attack.

Driss Oukabir, left, and Salah El Karib, suspects in the attacks, leave a base on the outskirts of Madrid before appearing in court. Both deny knowing involvement in the attacks. (Associated Press)

The owner of a cybercafé in Ripoll, the Pyrenees hometown to most of the 12 men originally identified as being members of the extremist cell behind the attacks, will remain in custody for at least 72 more hours while police inquiries continue, the judge said.

The questioning the four men underwent during their initial court appearances provided new details about the scope of the cell's activities and the events leading up to the attacks in and around Barcelona Thursday and early Friday.

Two of the suspects identified a Ripoll imam, Abdelbaki Es Satty, as the ideological leader of the group, according to a judicial official who heard Tuesday's interrogations. One said the bombs were being made to target a Barcelona monument where the imam planned to blow himself up as well, the court official said.

Instead, Es Satty and another man accidently blew themselves up while preparing explosives in the home workshop in Alcanar, a coastal town south of Barcelona, police have said. The court official was not authorized to speak about ongoing cases and requested anonymity.

Plans to attack famous church

Five others were shot dead by police during the vehicle and knife attack in Cambrils. One, the suspected driver of the van that mowed down pedestrians in Barcelona's Las Ramblas promenade, was shot and killed in a vineyard not far from the city on Monday.

Mohamed Houli Chemlal, alleged member of a terror cell accused of killing 15 people in attacks in Catalonia, leaves a Civil Guard base on the outskirts of Madrid. Chemlal said in court that the group was planning an attack involving explosives on landmarks around the city. (Associated Press)

Houli Chemlal, the only survivor of the Alcanar blast, told the court he was alive because he was on the ground floor of the house washing dishes after dinner. He testified from a wheelchair without lifting his eyes up from the ground, according to the court official.

Chemlal said in court that the group was planning an attack involving explosives on landmarks around the city, including Sagrada Familia, the famous church designed by Antoni Gaudi.

Oukabir testified that he rented the vans used in the attacks but thought they were going to be used for a house move. His brother was one of the five men shot dead Friday by police in Cambrils.

According to another person who attended Tuesday's hearings, Oukabir said he initially lied out of fear and told police his brother had stolen his ID to rent the vehicles. The person spoke on condition of anonymity to discuss the hearing.

Aallaa, who said an Audi A3 used in the attack in Cambrils was registered under his name but used by a sibling, had one brother killed in Cambrils and another who is believed to be a second casualty of the Alcanar house blast.

12-man extremist cell

Ripoll cybercafé owner Sahl El Karib told the judge he was only trying to make a profit when he bought at least two airplane tickets for two alleged members of the cell. Police raided the cybercafé on Tuesday, as well as a farmhouse in another town, searching for more evidence.

The four suspects arrested in relation to the vehicle attacks in Catalonia arrive at court in Madrid on Tuesday. (Chema Moya/EPA)

The lone fugitive from the cell — 22-year-old Younes Abouyaaqoub — was shot to death Monday west of Barcelona after a massive, dayslong manhunt. Police say he flashed what turned out to be a fake suicide belt at two officers who confronted him in a vineyard.

The judge's document said Abouyaaqoub drove the van that barrelled through the Las Ramblas promenade, zig-zagging to hit as many people as possible.

Abouyaaqoub's brother and friends made up the rest of the 12-man extremist cell. Police said with Abouyaaqoub's death, the group's members were all dead or in custody.

Chemlal was born in Melilla, one of Spain's two North African coastal enclaves that have borders with Morocco. Spanish media say the other 11 suspects are all reportedly Moroccans who lived in Spain.