A 15-year-old with tuberculosis has received a 4.5-year sentence for terrorism.