BERLIN (AP) — A 21-year-old German has been arrested at the French border on suspicion of trying to buy a firearm in preparation for an Islamist attack, officials said Friday.

Prosecutors in the southwest German state of Baden-Wuerttemberg said the man, whose name wasn't released, was detained Thursday as he tried to enter from neighboring France, where he lives.

German state police and officers from a tactical response unit in the French town of Kehl were involved in the operation, prosecutors said in a statement.

German authorities said the suspect allegedly belongs to the “radical Islamist spectrum” and had obtained several manuals for the construction of improvised bombs and incendiary devices, and shared them with others. He was on his way to Germany to purchase an assault rifle, prosecutors said.

Police seized the man's cellphone and cash he allegedly intended to use to buy the weapon, and his home in Kehl was searched, they said.

The suspect was ordered held in jail by a judge in Karlsruhe on Friday.

Prosecutors said they had no information on where precisely the man allegedly intended to carry out the attack.