Prosecutors quoted experts as saying that the suspect had been suffering from paranoid schizophrenia since 2007.
Aman charged with terrorising a Norwegian city with bow, arrow and knife in 2021, has confessed to murder of five people.
According to the NTB news agency, although much attention was focused on the bow and arrow at the time of the October incident, all of the deceased died of knife wounds.
Three other people were wounded, and he was accused of having thrown a knife at three police officers.
The agency said that, at the start of his trial, the man justified his crime with a desire for rebirth.
“I had the idea that I had to kill in order to be reborn in a good place,’’ the news agency quoted the suspect as saying.
Prosecutors hope to have the suspect placed in a psychiatric facility.
They quoted experts as saying that the suspect had been suffering from paranoid schizophrenia since 2007, been mentally ill during the crime, and was to be considered non-compos mentis.
In the courtroom, the prosecution played footage from surveillance videos showing the attacker shooting at customers with a bow and arrow in a supermarket.
A customer had barricaded himself in the supermarket garage and alerted emergency services.
“Hide, hide!” he shouted to another customer during the call, according to a recording of the conversation.
“He tried to shoot me!” reported a distraught woman, who had also placed an emergency call.
(dpa/NAN)