The prime suspect for the Berlin massacre was under covert surveillance for months as a possible terrorist threat until police let him slip through their grasp earlier this month.

Anis Amri, 24, a Tunisian asylum seeker who arrived in Germany last year, was investigated for “preparing a serious crime endangering national safety”, involving funding the purchase of automatic weapons for use in a terrorist attack.

Amri had been arrested earlier this year and was known to be a supporter of the terrorist group thought to be behind the Sousse terrorist attack in Tunisia, as well as being a suspected disciple of a notorious hate preacher.

He had multiple identity documents with six different aliases under three nationalities, and a criminal record in Italy and Tunisia. He spent four years in an Italian prison before travelling to Germany after an expulsion order expired.

The German authorities, who were on Wednesday facing serious questions about how Amri was still at large, tried to deport him in June, but because he had no valid papers proving his nationality he was allowed to stay.

In a further twist, Germany had asked Tunisia to issue a new passport for him so he could be deported, but the document only arrived on Wednesday – two days after the Christmas market attack that claimed 12 lives. It also emerged that the killer might have received hospital treatment for his injuries before slipping away.