De spanske myndigheder har anholdt en 27-årig marokkansk mand i Madrid for påståede terroraktiviteter og online-radikalisering.