Mohammed Harrak al Loutah, the 26-year-old Moroccan arrested in Palma on Tuesday and suspected of having links with the so-called Islamic State, has been ordered to be detained in prison by the High Court in Madrid.

Accused, among other things, of participating in the preparation of a terrorist attack in Spain, Judge Carmen Lamela heard his statements by videoconference link from the Palma court, and she instructed that he should be kept in unconditional custody, without bail therefore. The judge cited the "seriousness" of terrorist crimes under three articles of the Penal Code, a "well-founded" fear that he might abscond because of his lack of roots in Spain and the risk of further criminality.

The judge was made aware of his having sought to join Spain's army, which he was unable to, and of having instead made plans to join the French Foreign Legion. Investigations into his background found evidence of training and of military-styled images from participating in Airsoft, the military simulation game and sport.

The court was also told that the suspected Jihadist had published content on social media in support of IS and had sought recruits to join the Jihad in Syria and Iraq. He himself, as shown on social media and from intercepted telephone calls, had declared his intention to go to Syria to fight alongside the Mujahideen of the Caliphate. He had also said that the Paris attacks had represented an "excellent day", one that had made "Europe tremble". On the internet he had looked for advice on how to avoid looking like a terrorist and for recommendations from Daesh for the security of "lone wolves and autonomous cells".

Suggestions on how to behave like "a normal tourist" were then used by Harrak in his efforts to recruit fighters to go to Syria and Iraq. In addition, it was found that on 28 March he had downloaded the publication "Strategy Notebook" from the Ministry of Defence's website.

He gave contacts on Facebook instructions as to routes for travelling across Europe and for adopting a "western look", while he advised against keeping files that could arouse suspicion on phones or other electronic devices. On 8 October last year, he proposed the commissioning of a terrorist attack in Spain on the WhatsApp group called "Al Andalusi", adding details as to its operational necessities.

On four Facebook profiles, he humiliated individuals with messages such as "it was not such a bad idea to finish with the scourge on humanity of Zionist Jew bastards; what a pity that they didn't allow him to achieve this". This was posted with a photo of Hitler. "The Jihad is the most wonderful thing that one can do for Allah's religion" and "we are ISIS" were among other comments he made.

Over recent months, he had been trafficking drugs, buying them in Morocco and taking them to the mainland. When his property was raided, 22 grams of cocaine were found along with precision scales, while in the locker at the restaurant where he had been working a similar set of scales was discovered.

In light of all this, the judge concluded that he had been operating within an organised group and had repeatedly engaged in activities of recruitment, of personal training and incitement to commit acts of a terrorist nature, among others. These were particularly dangerous and also represented a total detachment from normal rules of co-existence.