BERLIN — The German city of Wuerzburg on Sunday held a memorial service for the victims of a brutal knife attack that left three women dead, while questions about the possible motive of the assailant remained unanswered.

Friday’s assault in and outside a store in the center of the Bavarian city left another five people seriously injured. The suspect, a 24-year-old Somali man, was shot in the leg by police and arrested after people surrounded him and tried to hold him at bay with chairs and sticks.

Investigators were still working Sunday to figure out what was behind the attack by what they believe was a lone assailant. They are assessing his mental health and trying to determine whether he was radicalized as an Islamic extremist. It was unclear whether he deliberately targeted women.

“We are all affected, because it could have happened to anyone,” Wuerzburg’s Catholic bishop, Franz Jung, said at the service in the city’s cathedral. It was attended by relatives of victims, the regional Protestant bishop, a representative of the city’s Muslim communities, Germany’s main Jewish leader, Bavaria’s political leaders, and police and rescue officers.

Mayor Christian Schuchardt, warned that “the crimes of individuals should never be ascribed or extended to ethnic groups, religions or nationalities,” adding that Somalis and refugees in general must not be blamed.

Flowers were piled up Sunday outside the nearby store where the attack started. Bavaria’s governor, Markus Soeder, laid a wreath and described the attack as “simply incomprehensible, appalling, senseless.”

“We must never answer such a hate-filled deed with hatred or revenge,” Soeder said. “I’m reading on the internet that some are saying, ‘it was someone with an immigrant background.’ Yes, but didn’t people with an immigrant background also help in exactly the same situation?”

The suspect was sent to jail Saturday pending a possible indictment. The regional criminal police office said Sunday prison officials have been informed that he could be a danger to himself, news agency dpa reported.