The suspect arrived in Germany as an asylum seeker in August 2015, the prosecutors said on Wednesday, after already living in the country for a decade some years earlier.
He was arrested the following August on an outstanding 2008 conviction for causing bodily harm.
After serving a 43-day sentence, he was kept in detention awaiting deportation to Tunisia before the authorities were forced to release him again.
"As the Tunisian authorities, despite repeated reminders from the German authorities, failed to supply the necessary deportation documents within the 40-day period, the suspect was released on November 4th, 2016," the statement said.
He was kept under surveillance from the day of his release until his arrest on Wednesday, it added.
Berlin police arrest three suspected jihadists
Police in Berlin said they arrested three people on Tuesday suspected of trying to reach foreign "war zones" in order to train to carry out an attack.
The suspects may be linked to Isis and had "planned to travel to war zones," likely Syria or Iraq, a Berlin police spokesman told AFP.
https://www.thelocal.de/20170201/pol...is-terror-plot