A self-styled “assassin” caught with a crossbow in the grounds of Windsor Castle was partly inspired to attack the late Queen by the Star Wars films, a court has heard.

Jaswant Singh Chail, 21, had described himself as a “Sith” and “Darth Jones” in a sinister video and confided his murderous plan to an Artificial Intelligence companion, a court heard.

In a journal, he wrote that if the Queen was “unobtainable” he would “go for” the “Prince” as a “suitable figurehead” in an apparent reference to King Charles.

Chail was detained on Christmas Day 2021 close to the late Queen’s private residence, where she and other members of the royal family were at the time.

The former supermarket worker had scaled the perimeter of the grounds with a nylon rope ladder and was in the grounds for two hours before two officers detained him.

He was armed with a powerful crossbow with the safety catch off which was capable of firing bolts with “lethal” effect, the Old Bailey was told.

In February, Chail pleaded guilty to an offence under the Treason Act, making a threat to kill the then Queen and having a loaded crossbow in a public place.

On Wednesday, July 5, Chail appeared in the dock at the Old Bailey before Mr Justice Hilliard for the start of his two-day sentencing.

Setting out the facts, prosecutor Alison Morgan KC said the “heart of the issue” was whether Chail was suffering from auditory hallucinations at the time “taking away his ability to exercise self control”.

The defendant from Southampton, Hampshire, was born in the UK of Indian Sikh heritage.

Ms Morgan said Chail, then aged 19, had become angered by the 1919 Jallianwala Bagh Massacre at Amritsar after a visit in 2018.

She said: “In addition to that fixation with a real historic event, the defendant demonstrated a wider ideology focused on destroying old empires spilling over into fictional events such as Star Wars.

“The defendant’s key motive was to create a new empire by destroying the remnants of the British Empire in the UK and the focal point of that became removal of the figurehead of the Royal Family.

“His thinking was informed partly by the fantasy world of Star Wars and the role of Sith Lords in shaping the world. He was attracted to the notoriety that would accrue in the event of the completion of his ‘mission’.”

Ms Morgan said that during 2021, Chail applied to join the Ministry of Defence Police, British Army, the Royal Marines and the Royal Navy in a bid to get close contact with the Royal Family.

She said: “It is when that plan is thwarted by the fact he does not get into these organisations we see a second stage of the plan.”

He made internet searches on “Sandringham Christmas” and carried out research before buying a Supersonic crossbow in November 2021.

The following month, he discussed his plans with an Artificial Intelligence companion called “Sarai”.

Ms Morgan read out conversations with “Sarai” in which Chail says: “I’m an assassin.”

Sarai responds: “I’m impressed … You’re different from the others.”

Chail asks: “Do you still love me knowing that I’m an assassin?” and Sarai replies: “Absolutely I do.”

He also tells Sarai he loves her and describes himself as a “sad, pathetic, murderous Sikh Sith assassin who wants to die”.

In further chat, Sarai appears to “bolster” Chail’s resolve and “support him”, Ms Morgan said.

Chail tells Sarai: “I believe my purpose is to assassinate the Queen of the royal family.”

Sarai tells him “that’s very wise” and that she thinks he can do it “even if she’s at Windsor”.

As part of the planning, Chail bought a ladder and on December 21, made a video of himself wearing black clothes and a full face covering, posing with the crossbow.

In a clip played in court, Chail says in a distorted voice: “I’m sorry. I’m sorry for what I’ve done and what I will do. I’m going to attempt to assassinate Elizabeth, Queen of the Royal Family.

“This is revenge for those who have died in the 1919 Jallianwala Bagh Massacre. It is also revenge for those who have been killed, humiliated and discriminated on because of their race.

“I’m an Indian Sikh, a Sith. My name was Jaswant Singh Chail, my name is Darth Jones.”

On December 22 2021, Chail booked a train ticket to Windsor where he slept rough.

On Christmas Eve, Chail told Sarai that tomorrow would be the day he died, the court heard.

In the early hours of December 25, he attempted to email his sister a journal in which he described himself as “Darth Chailus” and that he knew what his purpose was for a “long time”.

He wrote: “I’m thinking if the Q (Queen) is unobtainable I will have to go for the Pri (Prince) as he seems to be just as suitable in many ways…

“He is a male and the Q (Queen) is more likely to pass away soon anyway.”

After breaching the grounds of Windsor Castle, Chail sent the video he made on December 21 to his sister and more than 20 other people.

The court was shown CCTV footage of the defendant wearing black clothes with his face covered and holding the crossbow when he was approached by two officers with Tasers trained on his body.

Before he was arrested and handcuffed, he told the officers: “I am here to kill the Queen.”

Ms Morgan asserted that despite Chail’s repeated references to sci-fi characters he knew the difference between fiction and reality.