The suspect in the Norway bow and arrow rampage which left five people dead had been flagged for possible signs of radicalisation, police said.
Officers had been worried about signs the man, who was 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.
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 a suspect was arrested half an hour later.
A number of the victims were in a supermarket when they were attacked.
A spokesman for Coop supermarkets 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.