An attack by a Danish man armed with a bow and arrow that killed five people in a Norwegian town appears to be a “terrorist act,” police said Thursday.

The victims, four women and a man, were 50 to 70 years old. Norway’s police security service said the investigation was still looking into the motive behind the rare mass killing, the country’s worst such assault in years.

Three people, including an off-duty officer, were also injured in the Wednesday evening rampage, which Norway’s new prime minister described as cruel.

“The incidents in Kongsberg currently appear to be a terrorist act, but the investigation … will clarify in more detail,” Norway’s police security service, or PST, said in a statement Thursday.

After reports streamed in of a man roaming the town center shooting at people with a bow and arrow, law enforcement officers in Kongsberg, southwest of Oslo, arrested a 37-year-old man whom authorities later identified as Espen Andersen Brathen.

An initial court proceeding was set to take place Friday after police, who said the man appeared to be acting alone, charged him on Thursday.

Regional police chief Ole B. Saeverud said that the suspect was a Muslim convert and that police had received reports in the past flagging that he may have been radicalized.

Brathen visited the mosque at Kongsberg’s Islamic Cultural Center a few years ago, the center’s chairman told Norway’s public broadcaster Thursday.

Oussama Tlili said that Brathen came several times to the mosque but did not pray and knew little about Islam. He seemed tense but non-threatening and Tlili decided against contacting the authorities.

After the attack, police released some personal details about the suspect because of rumors circulating on social media about possible perpetrators who ultimately were not involved.

Police chief Oeyvind Aas on Oct. 13 said a man armed with a bow and arrow killed and injured several people in Kongsberg, Norway. (The Washington Post)

Norwegian media reported that a court had granted a restraining order last year for the accused to stay away from two of his family members for six months after he threatened to kill one of them. The police attorney said that psychiatric experts would assess the man Thursday and that he had confessed to Wednesday’s attack.

The confrontation began shortly after 6 p.m. local time in an area of Kongsberg around a Coop Extra supermarket, according to police and local media. Helicopters, bomb squads and police descended on the town, ordering people to stay inside.

When the first patrol arrived, the attacker tried to target officers with his weapons, too, before they arrested him about 30 minutes later.

The next morning, many residents were in shock. “I heard a scream I had never heard before,” Thomas Nilsen told Norway’s public broadcaster NRK. “I will never forget it — it sounded like a death cry.”

Flags in Kongsberg were flying at half-staff, and mourners placed flowers and lighted candles in the town’s center.

Police in the Scandinavian country, most of whom are usually unarmed, were temporarily ordered to carry weapons Wednesday night, the justice minister said.

The killings rocked the town hours before acting prime minister Erna Solberg, who called them “gruesome,” was due to leave office. The new prime minister, Jonas Gahr Store, who took over on Thursday, said it was “a cruel and brutal act.”

It was the country’s worst mass killing since 2011, when a right-wing extremist killed 77 people in a bombing and shooting. He was given the maximum jail term of 21 years — but his sentence can be extended indefinitely as long as he is considered a danger to society.

This report has been updated.