The suspect in the deadly Berlin Pride attack sought to join the Islamic State group, German prosecutors say.