The suspect in the Norway bow and arrow rampage which left five people dead had been flagged for possible signs of radicalisation, police have said.
Officers had been worried about signs the man, who is a Muslim convert, may have been radicalised, police chief Ole Bredrup Saeverud said at a news conference.
The 37-year-old Danish man is in custody.
According to prosecutor Ann Iren Svane Matthiassen, he admitted carrying out the attack in Kongsberg, to the southwest of capital Oslo which also left two others wounded.
Thomas Nilsen lives near the scene of the attacks and said he came out of his house after hearing what he initially thought was an argument.
“I thought it was war, because it was so intense.” he told NRK.
“But then I heard a scream I have never heard before. It was a screaming scream that burned into the soul. I will never forget that. I perceived it as a death cry.”
The death toll was the worst of any attack in Norway since 2011, when far-right extremist Anders Behring Breivik killed 77 people, most of them teenagers at a youth camp.
Police were first alerted to events in Kongsberg at 6.15pm local time, and the suspect was arrested half-an-hour later.
There was a confrontation with officers and the man tried to run away before he was arrested, the police said.
A number of the victims were in a Coop Extra supermarket when they were attacked.
A spokesman for the chain said: “We can confirm that there has been a serious incident in our store and that none of our employees are physically injured.
“We are now concerned with following up our employees, and beyond that, we refer to the police investigation.”
Both of the people left injured were taken into intensive care, and one was an off-duty police officer who was in the supermarket at the time.
Additional officers were deployed following the incident, and the usually unarmed constables were told they should temporarily carry weapons.
The Norwegian police directorate said: “This is an additional contingency measure. The police do not yet have any concrete indications that there is a change in the threat level in the country.”
Kongsberg, a small town of some 26,000 inhabitants, is about 66 kilometres (41 miles) southwest of Oslo.
Local officials said anyone who needed support would be welcome at the town’s main church.