A Tunisian detained in Germany on suspicion of planning an Islamist-motivated attack produced ricin and tested the lethal toxin on a hamster, prosecutors said on Friday.