A student accused of carrying out a hammer attack at a public school has told a jury he has no memory of the incident and was sleepwalking at the time.

The 16-year-old was wearing just his boxer shorts when he attacked two boys and a housemaster at Blundell’s School in Tiverton, Devon, the court was told.

Exeter Crown Court heard that the teenager, who cannot be identified for legal reasons, had armed himself with three claw hammers.

The teenager accepts he carried out the attacks but says he is not guilty of attempted murder because he was sleepwalking.

Giving evidence on Friday, he told jurors he remembers going to sleep on the evening of June 8 last year.

Representing the boy, Kerim Fuad KC, asked him: “What was the next thing you remember?”

The boy replied: “I remember being in the room. The room was covered in blood. What I could see was blood. I didn’t hear anything.

“I remember walking out to the corridor.”

Mr Fuad asked: “Are you aware of having sleepwalked in the past?”

The boy replied “I have”, and told the court his mother found him at the bottom of a staircase at their home around 10 years ago.

Mr Fuad asked the boy what he could remember after the incident at Blundell’s School, which happened shortly after 1am on June 9.

The boy said: “I knew something really bad had gone on and everyone was looking towards me.

“I didn’t remember doing anything so the only rational thing I was thinking was that I was sleepwalking.”

The boy described himself as “scared and anxious” after being arrested and taken to custody in a police car.

Asked why he replied “no comment” to questions in police interviews, he said it was on the advice of his solicitor.

The boy told the court he kept two hammers by his bed “for protection”, with a screwdriver and a Swiss Army knife that he owned also in his room.

Mr Fuad asked: “What did you need protection from?”

The boy replied: “The zombie apocalypse.”

He told the jury he had seen depictions of zombies in films and TV series such as The Walking Dead.

Mr Fuad asked: “Did you think the apocalypse was real?”

The boy said: “Yes, I did.”

Mr Fuad asked: “Do you think it is real now, today?”

The boy replied: “Yes, I do.”

Asked to explain what a zombie apocalypse was, the boy said: “The end of the world.”

He told jurors he had spoken of his fears about zombies to friends but “they might have perceived it as a joke”.

Mr Fuad asked: “Why did you need protection from them?”

The boy replied: “Zombies are vicious creatures.”

Previously, the jury was told that the two boys were asleep in cabin-style beds in one of the school’s boarding houses when the defendant climbed up and attacked them.

Housemaster Henry Roffe-Silvester, who was asleep in his own quarters, was woken by noises from the boarding house and went to investigate.

When he entered the bedroom, he saw a silhouetted figure standing in the room who turned towards him and repeatedly struck him over the head with a hammer, the court heard.

Both boys suffered skull fractures, as well as injuries to their ribs, spleen, a punctured lung and internal bleeding.

Mr Fuad asked the defendant whether he intended to kill Mr Roffe-Silvester and the two boys. He replied: “No.”

The boy said: “I feel very terribly sorry for all three individuals because of what I did to them.

“I feel very sorry for everyone, the families and themselves.”

Mr Fuad asked: “Were you awake when you did these things?”

The boy replied: “No.”

Mr Roffe-Silvester suffered six blows to his head.

The defendant, now aged 17, denies three charges of attempted murder.

The trial continues.