Defending, Fallon Alexis, said the boy has shown a clear willingness to change his ways.

She said: “His presenting risk factors no doubt are there but he is of previous good character with no convictions.

“In addition he has an extremely supportive family and in relation to that if you want to hear from them then they are present.

“He recognises now how childish it was and how the behaviour is not what he should have been doing.

“He did have a desire to travel to Syria because of what was said to him. But he does believe that Islamic State is extreme and that they do not represent Islam.

“He is clearly a bright man with academic ability that you have seen.

“He has shown a willingness to engage, therefore enabling him to provide this court an opportunity for him to rehabilitate himself within the community.”

District Judge Emma Arbuthnot judge later told the boy’s parents, who sat on either side of him in the public gallery, not to blame themselves as it is impossible to monitor a child’s online activity all the time.