Kieran Ridley, 32, told consultant psychiatrist Dr James Finlayson that he thought he was a Jedi Knight when he started the blaze at house outside Mallaig, Lochaber, in October 2015.
The High Court in Edinburgh heard how Mr Ridley made the admission during an interview between the pair in the days following his arrest.
Dr Finlayson recalled the details of the interview when he gave evidence to defence advocate Herbert Kerrigan QC.
Reading from a report that he wrote about Mr Ridley’s health, Dr Finlayson told the court about how Mr Ridley described his state of mind when he started the fire.
Dr Finlayson said: “He said ‘it was a bit like Star Wars. I thought I was Luke Skywalker. I think it then went a bit mad’.”
Dr Finlayson, a defence witness, was giving evidence on the fifth day of proceedings against Mr Ridley, a prisoner of HMP Inverness.
Prosecutors and Mr Ridley’s defence team have agreed evidence in which neither party disputes that Mr Ridley switched on a kitchen cooker at Mallaig Mhor property on 27 October last year.
They have also agreed that Mr Ridley poured petrol on to a refuse bin which caused the flames to “take effect” in the kitchen.
Jurors have also heard that lawyers do not dispute that Mr Ridley then left the property having locked the front and back doors of the house.
The court heard that Mr Ridley also locked some of the windows in the property and that he did this whilst “being aware” that there were 11 people inside.
The youngest person in the property at the time of the 27 October blaze was a two-year-old child, who cannot be named for legal reasons.
However, Mr Ridley’s lawyers have entered a not guilty plea on their client’s behalf.
They have lodged a special defence which states that Mr Ridley was not criminally responsible for his actions due to him having a “mental disorder”.
On Thursday, the court heard how Mr Ridley was initially taken to a medical facility in Inverness after being detained by police following the fire.
However, he was then arrested after being assessed by medical staff there and taken to HMP Inverness.
Dr Finlayson interviewed Mr Ridley during this time period.
Dr Finlayson told Mr Kerrigan that his client said that a London-based psychiatrist had diagnosed him with “drug induced psychosis” earlier in 2015.
The medic also said that Mr Ridley, who is originally from Worcester, said that he had taken magic mushrooms before starting the fire.
Mr Ridley, who worked in IT in the City of London, also told the psychiatrist that he had drank 20 pints of cider on the night he started the fire. He may have inhaled smoke from “cannabis” which was being smoked nearby.
The trial continues.