Matthew Brook of No5 Barristers’ Chambers led the prosecution of a 17-year-old who was ‘hours away from committing an act of atrocity’ in a Cardiff terror plot.

The trial at Birmingham Crown Court heard that Lloyd Gunton had earlier researched the security arrangements of a Justin Bieber concert on the day he was arrested.

The teenager, from near Llantrisant, South Wales also looked into Cardiff Castle, the New Theatre, the Capitol shopping centre and Central Library

The court heard that Gunton had become radicalised and was investigated after he posted terror-related content and images on social media sites. Police searched his home and belongings and seized his mobile phone and laptop.

Officers found a YouTube video of the documentary “British Islamic Extremists” playing on his phone while two copies of an IS propaganda magazine were found on his laptop. One showed instructions on how to carry out a terrorist knife attack, while the other had details on how to carry out a terror attack with a vehicle.

His school rucksack was found to contain a large kitchen knife and a hammer. There was also a martyrdom letter – claiming Gunton was an IS soldier and had attacked Cardiff in Allah’s name – which the prosecution said was to be used to explain his actions in the event of his death.

Matthew Brook had told the court: “Why would he have written such a letter? Because if you are going to commit a terrorist attack in which you presume you will die, you need people to know afterwards why you did it – it’s a way of spreading the terror and the message of terror.”

The jury heard Gunton plotted to commit mass murder in an Islamic State-inspired vehicle attack.

He was found guilty of one charge of engaging in the preparation of a terrorist act, two charges of encouraging terrorism, and a further two charges of possessing terrorist information.

He was given a life sentence with a minimum term of 11 years.