Croydon police station killer Louis De Zoysa made two failed bids to convince judges that a self-inflicted irreversible brain injury had left him unfit to instruct his legal team.
Details of legal submissions made on his behalf could not be reported until the end of the 25-year-old's murder trial.
During a three-day hearing at Northampton Crown Court last November, it emerged that De Zoysa had managed to shoot himself in the neck with a Colt revolver despite being handcuffed to the rear in a holding cell.
High Court judge Mr Justice Jeremy Baker decided that De Zoysa was fit to enter a plea and give evidence in his own defence, after being told the former University College London student was given a whiteboard and pen to communicate with medical experts due to speech difficulties.
The judge also heard how tax office worker De Zoysa, who had part of his skull removed during life-saving emergency medical treatment, now suffers weakness in his right arm and leg.
Although he can walk with the aid of a stick, he appeared in the dock last November in a wheelchair, having arrived at court in a private ambulance rather than a prison van.
In the two years after the fatal shooting, De Zoysa has been assessed by numerous consultants, including a neurosurgeon and experts at Broadmoor high security psychiatric hospital.
In seeking a ruling that De Zoysa was unfit to plead, the defence relied on the opinion of neuropsychiatrist Dr Quinton Deeley.
Dr Deeley told the court that as well as using the whiteboard to communicate, De Zoysa had sometimes replied in short spoken phrases, but was unfit to plead due to an inability to understand the course of the proceedings, or to give adequate instructions to his legal advisers.
But Dr Nigel Blackwood, a consultant forensic psychiatrist, said that although De Zoysa was unfit to plead six months after the killing, he had since assessed him to be fit to plead "provided that the court room process was sufficiently simplified and the accused had the services of an intermediary".
After a follow-up examination, Dr Blackwood said, he was able to establish aspects of the defendant's background history.
Dr Blackwood added: "He had purchased a pistol and bullets on the internet. He had assembled a shotgun from 'old parts'. He had worked on weapons in his garage in Banstead for six months before the alleged offence.
"He was unsure why he had done this: he stated that he did not want to hurt anybody. He accepted that he had been misusing cannabis for three years.
"He estimated that he was spending £200 per month on 'skunk'. This had not affected his work function. He had no particularly close friends."
During questioning by medical experts, the court heard, De Zoysa said he had no interest in extremist ideologies, including extreme right wing thinking or Islamic extremism, and denied being homophobic.
It also emerged that De Zoysa had claimed to have been carrying a pistol for four or five months before killing Sgt Matt Ratana, having been attacked by three people during a drug-related row.
Dr Blackwood added: "On the night in question, he had travelled from his home in Banstead to Norbury, intending to visit his family home.
"He stated that he had been stopped by two police officers and described this as a 'regular check'. He accepted that the finding of bullets on his person may have worried the police.
"He stated that he could not remember the further events at Croydon police station. He knew that he was accused of shooting a police officer therein.
"Mr De Zoysa appeared able to understand the charges. He stated that these were 'M' (agreeing to murder with a verbal prompt) 'F' (firearm with a verbal prompt) and 'A' (writing 'ammo' on his whiteboard).
"He appeared capable of deciding whether to plead guilty or not; a plea of guilty meant 'did it' and not guilty 'not'."
Confirming details of an assessment of De Zoysa which took place in March 2022, Dr Blackwood continued: "He could draw his clothing on the night in question and identify where his holster had been positioned.
"When I relayed the police account to him, the intermediary checked how many bullets had been shot according to my account, and he correctly remembered four."
Mr Justice Jeremy Baker was told De Zoysa did not appear to be suffering from any psychosis, hallucinations, thought disorder or paranoia, despite having claimed to have considered "killing deer for food" during the early stages of the Covid pandemic.
The judge said defence lawyers would be able to show De Zoysa "unassailable" CCTV footage of the sequence of events during the shooting, telling the court: "The accused will be able to give appropriate instructions."
But despite the ruling, De Zoysa made a second attempt to convince another judge, Mr Justice Johnson, that he was unfit to plead or understand the charges against him.
A hearing in April this year included evidence from consultant forensic psychiatrist Dinesh Maganty, who said it was possible De Zoysa had suffered a "meltdown" related to autism spectrum disorder.
Dr Maganty, who conducted a three-hour assessment of De Zoysa in March, said he had shown the CCTV of the killing to him at a healthcare facility in Northampton.
When asked if he was guilty of murder, De Zoysa "said no and he wrote 'bullet proof vest'" on a whiteboard.
Asked if De Zoysa could understand the meaning of diminished responsibility, Dr Maganty said: "He seemed to have difficulty with the concept at every level.
"In simple terms he does not understand the difference between murder and manslaughter."
But Mr Justice Johnson also ruled that De Zoysa was fit to enter a plea.