An Islamist militant cell that last week 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 on Tuesday, 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 (holy war) 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 late on Tuesday 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 members of the cell lived, will remain in police custody for now pending further investigation. The fourth man, Mohamed Aalla, was released on certain conditions.

Chemlal was the only one of the four suspects who admitted a role in the plot, the sources said. The other three all denied involvement.

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

Islamic State 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 before 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 a day before the Barcelona attack when a house the group was using to build bombs blew up.

According to Judge Andreu's court order, 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.

BELGIAN LINK?

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.

Investigators also found receipts for purchases made by the group, including 500 litres of acetone and other materials which can be used to make explosives, bought at the beginning of August, the court document showed.

Last Thursday at 9:26 p.m. local time (1926 GMT), a few hours after the Barcelona van attack, they bought four knives and an axe that were used in the Cambrils attack, it said.

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

Chemlal, who told the court he regretted his part in the plot, said Es Satty, the imam in Ripoll, the small town in northeastern Spain where many of the group came from, led the cell, according to the sources.

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 might 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 bombs 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 triacetone triperoxide, 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.

Oukabir rented the van used in the Barcelona attack and Aalla's Audi A3 was used in the Cambrils attack, but both denied involvement in the plot. El Karib paid for a flight from Morocco for Oukabir, but said he only did so because Oukabir's brother did not have a credit card and that he reimbursed him.

At the remote northern Moroccan village of Tangaya, in the country's mountainous Rif region, security officials have been stationed near Es Satty's family home and barred a reporter from approaching.

Some residents in the village, which is surrounded by cannabis plants that many families in the region grow to stave off poverty, reacted with suspicion and said they did not know the imam.

Others said Es Satty, who was 44 and had served a jail term for drug-trafficking in Spain, had left more than 15 years ago and had not returned recently.

"The imam left a very long time ago," said one man who declined to give his name. "Since he was convicted in Spain ... he no longer came to the village, but met up with his family in Tangier."

La Vanguardia said Moroccan authorities had arrested a man who had been in touch with Moussa Oukabir, one of the suspects killed by police in Cambrils, and may have played a role in connecting the Catalonia-based cell with Islamic State.

Spanish news agency Efe said a man who is believed to have lived or spent some time in Abouyaaqoub's flat was arrested in Casablanca.