Police officers who were on guard duty locked the police station's door and the entrance to its interior courtyard. The suspect tried and failed to force them open, prosecutors said in a statement. Special forces officers were called to the scene and subdued him with a stun gun.
Investigators who searched the suspect's apartment found a flag of the Islamic State group drawn on a wall.
The incident in Koblenz follows an Aug. 23 knife attack in the western city of Solingen in which a suspected extremist from Syria is accused of killing three people. A man killed in a shootout with police officers near the Israeli Consulate in Munich on Thursday also is suspected to have been radicalized.