A 20-year-old man has appeared in court accused of plotting a terrorist attack after he was arrested by counter terrorism police.