A teenager who planned an Islamic State-inspired terrorist attack on a pop concert a month after the Manchester Arena bombing has been given a life sentence and told he will serve at least 11 years in prison before being considered for parole.

Lloyd Gunton, 17, researched security for a Justin Bieber gig in Cardiff and wrote a “martyrdom letter”. Police raided the boy’s home in south Wales on the day of the show and found a claw hammer and a gutting knife in his school rucksack.

His letter read: “I am a soldier of the Islamic State. I have attacked Cardiff today because your government keep on bombing targets in Syria and Iraq. There will be more attacks in the future.”

Jurors at Birmingham crown court were told Gunton had also written a note with bullet points including “run down the non-believers with a car” and “strike the infidels who oppose Allah in the neck”.

The defendant, from Rhondda Cynon Taf, had denied preparing for an act of terrorism, two charges of encouraging terrorism online and two charges of possessing editions of an Isis propaganda magazine.

He told the jury he had a “stupid interest in the gory” and was curious about Isis, but claimed he had no intention of carrying out a terrorist attack.

In the witness box, Gunton said he did not possess a copy of the Qur’an, did not believe in Islam and ate ham.

Insisting he was merely curious, he told the court: “I wanted to see how easy it was for people who had an interest in terrorism to go online and get information, because the police and the government are trying to crack down on terrorism and radicalisation. I wanted to see if it was possible, not for me, but from someone else’s point of view.”

His defence counsel, Delroy Henry, likened the teenager’s interest in Isis to rubberneckers on a motorway. “He was drawn into it, curiosity getting the better of him,” Henry said.

Ordering Gunton, who suffers from an autism spectrum disorder, to be detained at Her Majesty’s pleasure, the judge Mark Wall QC, told the former A-level student: “The police found a rucksack in your room which contained a knife, a hammer and what has been referred to as a suicide note or a martyrdom letter. In the martyrdom letter you referred to yourself as a ‘soldier of Isis’.

“The letter was written in such terms that it was obviously to be found and read after you had carried out a terrorist attack.”

The judge described the items found in the rucksack as a “terrorist’s kit” and said it was clear from Instagram posts in English and Arabic that Gunton, who lived on a farm, had planned to launch an attack.

The judge told the teenager: “I sentence you on the basis that at the time of your arrest you were within hours of committing an act of atrocity on the streets of Cardiff. It is clear that Cardiff was your target. In particular you had made a number of online searches in connection with a concert that was being given by Justin Bieber at the stadium in Cardiff on 30 June.

“Whether you would have targeted people attending that concert or others going about their lawful business in Cardiff that night is not certain. It is not possible to estimate how many people would have been murdered or seriously injured by your actions, as the attack was foiled before you could undertake it.

“I am sure that you planned not just the killing of one person but rather mass murder. In my judgment I must pass an indeterminate sentence. Your actions show a total disregard for human life. I cannot foresee a time when I can be confident that your danger will have ended or decreased sufficiently to enable me to pass a determinate or extended sentence.”

The judge lifted reporting restrictions banning the media from naming Gunton after an application to the court by the Press Association.

The crown opposed the application to lift the restrictions, but the judge ruled that it was in the public interest to identify Gunton, who is 18 in April.

After the hearing, Det Supt Jim Hall, the head of the Wales extremism and counter-terrorism unit, said: “The sentence reflects the gravity of the offences committed by this 17-year-old and, I hope, will serve as a deterrent to anyone considering such actions in the future.

“This case has highlighted the ongoing concerns with young people gaining access to extremist material on the internet and how quickly that can lead to radicalisation. This individual actively sought out that material and as he became radicalised his behaviour quickly became a concern.

“We urge people to speak to a family member, teacher or us so that we can intervene at the earliest opportunity to keep the public safe. You will not get into trouble by reporting concerns.”