This is an archived article and the information in the article may be outdated. Please look at the time stamp on the story to see when it was last updated.

BERLIN (AP) — An 18-year-old man suspected of having planned an extremist attack in Frankfurt has been arrested near Germany’s border with Austria as he attempted to leave the country for Iraq and join the Islamic State group, German investigators said Thursday.

The man, a German citizen with Moroccan roots who grew up in Germany, was arrested on Wednesday at a highway rest area near Passau, Frankfurt prosecutors and Hesse state criminal police said in a statement.

The arrest stemmed from an investigation that started last summer. The man, whose name wasn’t released, is accused of having planned a shooting attack in Frankfurt, of having researched how to build explosive devices online, and of procuring a stabbing weapon that he kept in his parents’ garage.

German authorities were alerted by a foreign intelligence service, which Thursday’s statement didn’t identify. When the suspect’s home was searched in August, investigators found depictions of the Islamic State group’s flag and ideologically loaded pictures of fighting and executions, but couldn’t immediately substantiate suspicions that he was planning an attack.

Further investigations suggested that he had put off his plans for an attack in Frankfurt for fear of being discovered and couldn’t find enough money to get a firearm, authorities said. Instead, he allegedly planned to leave Germany on Wednesday to travel overland to Iraq, where he hoped to join IS, “’slaughter’ infidels” and fight state institutions.

The suspect was arrested before he could leave the country and his home was searched again.