Danish police believe a shopping centre shooting that left three people dead and four others seriously wounded was not terror-related.

The gunman acted alone and appears to have selected his victims at random, they said on Monday.

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 Søren Harbo told reporters.

Police have said the man was known to mental health services without elaborating.

Danish Prime Minister Mette Frederiksen and minister of justice Mattias Tesfaye lay flowers at the scene
Danish Prime Minister Mette Frederiksen and minister of justice Mattias Tesfaye lay flowers at the scene (Sergei Grits/AP)

Police have not identified a motive for Sunday’s attack inside one of Scandinavia’s biggest shopping centres.

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,” said Danish Prime Minister Mette Frederiksen, 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 Mr Thomassen.

Copenhagen Police Chief Inspector Soeren Thomassen gives an update on authorities' investigation
Copenhagen Police Chief Inspector Soeren Thomassen gives an update on authorities’ investigation (Martin Sylvest/Ritzau Scanpix/AP)

Four more people were taken hospital with gunshot wounds and were in a critical but stable condition.

In all 30 people were hurt, most in the panicked stampede after the shots rang out at the Field’s shopping centre, 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 on 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 allows authorities to keep a person in custody during an investigation.

The judge asked media to leave and held the detention hearing behind closed doors. He will remain in custody until July 28, police said.

Mr Thomassen said police had no indication that anyone helped the man.

People are evacuated from Field’s shopping centre in Copenhagen, Denmark
People are evacuated from Field’s shopping centre in Copenhagen, Denmark (Olafur Steinar Rye Gestsson/Ritzau Scanpix/AP)

“There is nothing in our investigation, or the documents we have reviewed, or the things we have found, or the witnesses’ statements we have gotten, that can substantiate that this is an act of terrorism,” said Mr Thomassen, who previously 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,” witness 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 centre, where people laid flowers on Monday.

People embrace each other in front of the shopping centre
People embrace each other in front of the shopping centre (Olafur Steinar Rye Gestsson/Ritzau Scanpix/AP)

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 realised the panic, including a man who grabbed his child from a pram 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,” Ms Stoltz said.

Police are seen outside the shopping centre
Police are seen outside the shopping centre (Olafur Steinar Rye Gestsson/Ritzau Scanpix/AP)

The Styles concert was cancelled due to the shooting.

Sunday’s attack came about a week after a shooting in neighbouring Norway, where police said a Norwegian man of Iranian origin opened fire during an LGBTQ festival, killing two and wounding more than 20.