FRANKFURT, Germany — The suspect in custody for a stabbing rampage in the western German city of Solingen that killed three people and injured eight is a 26-year-old Syrian man, authorities said early Sunday.

The suspect turned himself in and admitted to the crime, Duesseldorf police and prosecutors said in a joint statement.

“The involvement of this person is currently under intensive investigation,” they said.

The attack, for which the Islamic State group claimed responsibility, occurred Friday evening in the Fronhof, a market square where live bands were playing at a festival to celebrate Solingen’s 650-year history. Mourners have made a makeshift memorial near the scene.

The arrest of the suspect threatens to stoke fears ahead of three state elections next month in Thuringia, Saxony and Brandenburg, which the anti-immigrant far-right Alternative for Germany (AfD) has a chance of winning.

The suspect came from a home for refugees in Solingen that was searched on Saturday, said North Rhine-Westphalia’s interior minister, Herbert Reul.

Der Spiegel, citing unidentified security sources, reported that the man moved to Germany late in 2022 and sought asylum, and that his clothes had been smeared with blood.

The police declined to comment on the Spiegel report.

Meanwhile, German federal prosecutors have taken over the case and are investigating whether the suspect was a member of Islamic State, a spokesperson for the prosecutors said.

The group described the man who carried out the attack as a “soldier of the Islamic State” in a statement on its Telegram account on Saturday: “He carried out the attack in revenge for Muslims in Palestine and everywhere.”

It did not immediately provide any evidence for its assertion, and it was not clear how close any relationship between the attacker and Islamic State was.

Hendrik Wuest, premier of the state of North Rhine-Westphalia, on Saturday described the attack as an act of terror.

Germany’s Federal Criminal Police Office (BKA) has counted around a dozen Islamist-motivated attacks since 2000.

One of the biggest was in 2016, when a Tunisian drove a truck into a Christmas market in Berlin, killing 12 and injuring dozens.

“The risk of jihadist-motivated acts of violence remains high. The Federal Republic of Germany remains a direct target of terrorist organizations,” the BKA said in the report earlier this year.