Accused detained by chance after being caught without a valid public transportation ticket and found with 10 pipe bombs.

Authorities in southern Germany say a 25-year-old man arrested on suspicion of attacking Turkish-owned grocery stores told investigators he considers himself a supporter of the armed group ISIL (ISIS).

Prosecutor Georg Freutsmiedl said on Sunday the suspect declared he acted out of “hatred for Turks”.

He is suspected of carrying out four attacks since April in the town of Waldkraiburg, about 60km (25 miles) east of Munich.

Six people were injured in the firebombing of a grocery store, while the other attacks involved stones being thrown through shop windows. He smashed the windows of a barbershop, a restaurant, and a snack bar in the town.

Freutsmiedl said the man, who was arrested on Friday, will be charged with 27 cases of attempted murder, serious arson, and serious bodily harm.

The suspect was detained by chance after being caught without a valid public transportation ticket. Police said they found 10 pipe bombs in his luggage and evacuated the station.

According to Freutsmiedl, the man called himself a follower of ISIL and had tried to join the group. He was planning further attacks on Turkish institutions.

Investigators later found 13 more pipe bombs in a car at a garage and 10 kilogrammes (22 pounds) of a chemical substance that could be used to make bombs. The explosive devices were reportedly skillfully constructed.

Police also seized a pistol and further materials from the man’s home. Investigations continue as it was unclear how the man obtained the weapon and what he planned to do next.

“We have to ask the question, what was he planning to do with so many pipe bombs?” said Freutsmiedl.

The suspect, who was not named, is a German citizen. His parents are immigrants from Turkey.

“I am relieved that this dangerous man is no longer going to cause any harm,” said Robert Kopp, police chief of the Upper Bavaria South district. He said the arrest had likely prevented serious acts of violence.

In Waldkraiburg, residents with Turkish roots responded cautiously to news of the man’s arrest. “I strongly suspect he is not the only one,” said Aleyna Yildiz, whose father owns a kebab restaurant.

She said it was unlikely that someone could do all that alone in the space of a few weeks.