A 21-year-old Afghan asylum-seeker was taken into custody Friday after stabbing three people in Ravensburg's town center, according to a statement from police.

The victims — two Syrian asylum-seekers aged 19 and 20 and a 52-year-old German man — were taken to the hospital. One of them is reportedly in critical condition.

Authorities said the man is under investigation for attempted murder and grievous bodily harm.

However, a judge on Saturday sent the attacker to a psychiatric institution instead of remanding him in custody after an expert said the Afghan suffered from a severe psychiatric disorder and had received mental health treatment in the past.

Police had blocked off parts of the southwestern town for much of Friday afternoon as experts interviewed witnesses and examined the scene. Two of the victims were found at a bus stop near one of the city's main squares, while the third was about 50 meters (54 yards) away.

Read more: German states look to reintegration to reduce migrant crime

Police sealed off much of Marienplatz in the center of Ravensburg while experts gathered evidence from the scene

Chance encounter

In an unusual twist, the suspect was apprehended by Ravensburg's mayor, Daniel Rapp, who told German news agency dpa that he happened to be in the area when the stabbing took place.

"The perpetrator stood in front of me suddenly with a bloody knife and threatened me," Rapp said. "Then I told him to put the knife down."

The man followed the instructions, according to Rapp. "It was an instinctive action," he said.

Read more: Germany's reporting on asylum-seekers exposes 'latent racism'

Police arrived shortly afterwards and arrested the man.

cw, nm/sms (AP, dpa)

Every evening at 1830 UTC, DW editors send out a selection of the day's hard news and quality feature journalism. You can sign up to receive it directly here.