KONGSBERG, NORWAY -- Residents of a Norwegian town with a proud legacy of producing coins, weapons and silver grappled Friday with the horrible knowledge that someone living in their community used a bow and arrow to attack people doing their grocery shopping or other evening activities -- and succeeded in killing five of them.

On a central square in Kongsberg, a former mining town of 26,000 people surrounded by mountains and located southwest of Norway's capital, people laid flowers and lit candles in honour of the four women and a man who died in Wednesday's attack. The victims ranged in age from 50 to 70, police have said.

"This a a small community so almost everybody knows each other, so it's a very strange and very sad experience for us," Ingeborg Spangelo, a teacher who brought her students to the impromptu memorial, said. "It is almost surreal or unreal."

Officers arrested a Kongsberg resident identified as Espen Andersen Braathen, a 37-year-old Danish citizen. He was detained about a half-hour after he allegedly began firing arrows in a supermarket where police tried to confront him but lost sight of him when he fired at them and they had to take cover, law enforcement authorities have said.

Andersen Braathen proceeded from the supermarket into a quiet downtown neighbourhood of wooden houses and birch trees, where he fired at people on the street and inside some apartments, police said. Along with the five people killed, three were injured.

Senior police officer Per Thomas Omholt said Friday that three weapons in all were used in the attack, but declined to identify the types or to reveal how the five victims were killed, saying investigators need to interview more witnesses and don't want their accounts tainted by what they read in the news.

Officers who responded to the first alert, at 6.13. p.m., encountered the perpetrator in the supermarket. That is where an off-duty police officer who was shopping was injured, reportedly hit by an arrow in the shoulder. Police were shot at twice with arrows, and as they sought shelter and called for reinforcement the suspect managed to escape. Investigators believe the five victims were killed afterwards.

"The killings were committed both outdoors and indoors. Among other things, (the suspect) has visited private addresses. In addition, arrows were fired at people in the public space," Omholt told a press conference.

The regional prosecutor leading the investigation has said that Andersen Braathen confessed to the killings after his arrest, and police said they think he acted alone. Norway's domestic intelligence agency said Thursday that the case appeared to be "an act of terrorism" but cautioned that the investigation was ongoing.

Norwegian broadcaster NRK said Friday that in 2015 the agency, known by its acronym PST, got information about Andersen Braathen and in 2017 they met the suspect. The following year, PST contacted Norwegian health authorities about the man and concluded that he was not driven by religion or ideology, but was seriously mentally ill. The VG newspaper said PST then believed he could carry out a "low-scale attack with simple means in Norway."

PST had no immediate comment.

Omholt said that as of Friday, investigators were continuing to explore possible motives or reasons for the attack but their "strongest hypothesis for motive is illness." Andersen Braathen's "health has deteriorated," the officer said, declining to give specifics.

"We work with several hypotheses. They are weakened and strengthened during the investigation," Omholt said. "We will find out what has happened, and why."

Andersen Braathen has been transferred to a psychiatric facility and "now the ball lies with the health authorities" on when police can question him. Omholt added that "at least" two experts will observe and evaluate Andersen Braathen to determine if he was legally sane at the time of the attack.

The suspect's mental health meant that "it is important to obtain information about the accused's past," Omholt said and called for witnesses. Police said they wanted to map his activities in recent years, including on social media.

Mass killings are rare in low-crime Norway, and the attack immediately recalled the country's worst peacetime slaughter a decade ago, when a right-wing domestic extremist killed 77 people with a bomb, a rifle and a pistol.

"The screaming was so intense and horrifying there was never any doubt something very serious was going on," said Kongsberg resident Kurt Einar Voldseth, who had returned home from an errand when he heard the commotion Wednesday. "I can only describe it as a `death scream,' and it burned into my mind."

Voldseth said he recognized the attacker, saying he lived nearby and "usually walks with his head down and headphones on."

"I have only spoken to him a few times, but I have had the impression he might be a person with problems," he said.

During an initial hearing Friday, a court in Kongsberg ordered Andersen Braathen held in custody for four weeks, including two weeks in isolation, and banned him from communicating with others.

"Reference is made to the extremely serious nature of the case, which has also led to great media interest both nationally and internationally. If the accused is not shielded from this and from other prisoners, important evidence could be lost," the ruling read.

He was being held on five counts of preliminary murder and three counts of preliminary attempted murder. Preliminary charges are a step short of formal charges, and a terror-related charge could be brought later if the evidence supports it, Omholt said.

Andersen Braathen didn't appear in court. His defence lawyer, Fredrik Neumann, told Norwegian news agency NTB he had no comments, saying of his client: "He has agreed to imprisonment, so then this really speaks for itself."

Police described him Thursday as a Muslim convert and said that there "earlier had been worries of the man having been radicalized." But neither police nor the domestic intelligence service elaborated or said why they flagged Andersen Braathen or what they did with the information.

According to Norwegian media, Andersen Braathen has a conviction for burglary and drug possession, and last year a court granted a restraining order for him to stay away from his parents for six months after he allegedly threatened to kill one of them.

Norway's new prime minister, Jonas Gahr Stoere, and Justice Minister Emilie Enger Mehl were expected to visit Kongsberg later Friday.

Kongsberg is located in a picturesque valley some 66 kilometres (41 miles) southwest of Oslo. Established in 1624 as a mining community after the discovery of silver in the area, it is where the Royal Norwegian Mint is based.

The community for decades had a weapons factory that initially produced guns, and now houses defence, aerospace and technology companies.

------

Olsen reported from Copenhagen, Denmark