An Islamist militant cell that used a van to kill 13 people in Barcelona had planned one or several major bomb attacks, possibly against churches or monuments, one suspect told a court this evening, according to sources close to the investigation.

They said the group was led by an imam who tutored its members, mainly young Moroccans, in jihad and told them: "Martyrdom is a good thing, according to the Koran," Mohamed Houli Chemlal told a Spanish High Court judge.

After a day-long hearing of four suspects in the plot, Judge Fernando Andreu ordered Chemlal and a second defendant, Driss Oukabir, remanded on charges of membership of a terrorist group and murder.

Chemlal was also charged with explosives possession.

A third suspect, Salh El Karib, who ran an internet cafe in a northeastern Spanish town where most of the alleged cell members lived, will remain in police custody for now pending further investigation.

The fourth man, Mohamed Aalla, was released on certain conditions.

Police yesterday shot dead 22-year-old Younes Abouyaaqoub, whom they had identified as the driver of the van that careered along the packed Las Ramblas boulevard in Barcelona last Thursday, killing 13 people and injuring 120 from 34 countries.

The so-called Islamic State militant group claimed responsibility for the van attack and a separate deadly assault, hours later, in the coastal resort of Cambrils, south of Barcelona.

In Cambrils, a car rammed passersby and its occupants got out and tried to stab people.

The five assailants, who were wearing what turned out to be fake explosive belts, were all shot dead by police, while a Spanish woman died in the attack.

Police say the imam suspected of leading the militant cell, Abdelbaki Es Satty, died when a house the group was using to build bombs blew up a day before the Barcelona attack.

According to Judge Andreu's statement, in the ruins of the house in Alcanar, southwest of Barcelona, police found several plane tickets to Brussels in Es Satty's name issued by the Spanish airline Vueling.

Also found, it said, was a note in Arabic entitled "Short letter from the soldiers of Islamic State in the land of al-Andalus for the crusaders, the hateful, the sinners, the unjust, the corruptors."

Al-Andalus was the Islamic name for Spain during the Middle Ages when much of it was Muslim-controlled.

The air tickets will raise questions about possible links of the group to Belgium, where a number of Islamist militant plots have been hatched or carried out. The document appears to be evidence of a link with Islamic State.

Chemlal told the court in the closed hearing that the group had obtained materials for making explosives in Spain, abroad, or via the internet, the sources said.

According to the sources, Chemlal told the court he regretted his actions, and was the only one of the four arrested over the van assault who admitted being one of the plotters.

The other three denied involvement in court, they said.

Chemlal told the court that Es Satty, the imam in Ripoll, the small town in northeastern Spain where many of the group came from, led the cell.

The group had planned to commit "one or several" attacks with explosives, Chemlal said.

He said there was no "clear or certain target" but he referred to attacks against churches and monuments, the sources said.

El Mundo newspaper reported that architect Antoni Gaudi's landmark Sagrada Familia church in Barcelona could have been a target but this could not be immediately confirmed.

The cell was making explosives and planned to use butane gas canisters to make a more powerful bomb, guided by tutorials found on the internet, Chemlal said.

The plan went wrong when an explosion wrecked the house where the plotters were making the explosives a day before the Barcelona attack, killing the imam and another man and leading the survivors to hurriedly change tactics.

Police found 120 butane cylinders at the house in Alcanar, southwest of Barcelona, as well as traces of TATP, or triacetonetriperoxide, an unstable explosive that can be made with household chemicals.

Chemlal was arrested after being hurt in the Alcanar blast.

The 21-year-old arrived at court wearing hospital-issue pyjamas, with a bandaged hand and cuts to his face and bare ankles.

Tuesday's hearing was the first in a long legal process, and it could be months or even years before the case is brought to a full trial.

In little more than a year, Islamist militants have used vehicles as weapons to kill nearly 130 people in France, Germany, Britain, Sweden, and now Spain.