COPENHAGEN, Denmark (AP) -- A gunman who killed three people when he opened fire in a crowded shopping mall acted alone and apparently selected his victims at random, Danish police said Monday, all but ruling out that the attack was related to terrorism.
Authorities filed preliminary charges of murder and attempted murder against a 22-year-old Danish man, who will be held for 24 days in a secure mental health facility while authorities investigate the crime, prosecutor Soren Harbo told reporters.
After the custody hearing, defense lawyer Luise Hoj said she agreed to have her client undergo a mental exam. She did not comment on the charges. Police have said the man was known to mental health service without elaborating.
Police have not identified a motive for Sunday's attack inside one of Scandinavia's biggest shopping centers. The suspect, carrying a rifle and knife, was quickly arrested, and Copenhagen chief police inspector Soren Thomassen said the man also had access to another gun. He said the firearms were obtained illegally but gave no further details.
"It was the worst possible nightmare," Danish Prime Minister Mette Frederiksen said Monday, calling the attack "unusually brutal."
The three killed were a 17-year-old boy and a 17-year-old girl, both Danes, and a 47-year-old Russian man, according to Thomassen. Four more people were hospitalized with gunshot wounds and were in critical but stable condition. In all, around two dozen people were hurt, most in the panicked stampede after the shots rang out at the Field's shopping center, on the outskirts of the Danish capital.
Gun violence is relatively rare in Denmark. The last shooting on this scale was in February 2015, when a 22-year-old man was killed in a shootout with police after an attack in the capital that left two people dead and five police officers wounded.
The suspect, who cannot be named by court order, was brought before a judge Monday in a packed courtroom to face three preliminary charges of murder and four of attempted murder. That's a step short of formal charges but allow authorities to keep a person in custody during an investigation.
When the court ruled that the hearing should be held behind close doors, the media were sent out. It wasn't immediately clear how the suspect pleaded. He will remain in custody until July 28, police said.
While authorities have said there is no indication that anyone helped the man, Copenhagen police inspector Dannie Rise said the investigation would be complicated.
"We need to put together this jigsaw puzzle," Rise said. "And it is huge."
Earlier, Thomassen said police had discovered nothing so far "that can substantiate that this is an act of terrorism." He has identified the man as an "ethnic Dane," a phrase typically used to mean someone is white.
Danish broadcaster TV2 published a grainy photo of the alleged gunman, a man wearing knee-length shorts, a vest or sleeveless shirt, and holding what appeared to be a rifle in his right hand.
"He seemed very violent and angry," eyewitness Mahdi Al-Wazni told TV2. "He spoke to me and said it (the rifle) isn't real as I was filming him. He seemed very proud of what he was doing."
Images from the scene showed people running out of the mall, where people laid flowers on Monday.
Chassandra Stoltz, an 18-year-old student who was on her way to a Harry Styles concert that was scheduled for Sunday night nearby, described a stampede as the shots rang out. At first, she and her sister and father thought it was because someone had spotted Styles -- but she soon realized the panic, including a man who grabbed his child from a stroller in the chaos.
"People were guiding us towards the exit sign, and we ran up the roof and we were stuck there for a while and then people were panicking all over the place and people were crying," Stoltz said.
The Styles concert was canceled due to the shooting.
Sunday's attack came about a week after a shooting in neighboring Norway, where police said a Norwegian man of Iranian origin opened fire during a LGBTQ festival, killing two and wounding more than 20.