Prosecutors alleged that the convicted, known only as Betram A, had pledged allegiance to the Islamic State terrorist group in the days before the planned attack. He also tried to purchase weapons.