BERLIN (Reuters) - A German court sentenced a 27-year-old German supporter of Islamic State to three years and three months in prison on Monday for plotting to lure police or soldiers into a trap and kill them with a home-made bomb.

The ruling came with German authorities on high alert ahead of Tuesday’s anniversary of an attack last year in which a failed Tunisian asylum-seeker plowed a truck into crowds at an outdoor Christmas market and killed 12 people.

Prosecutors said the suspect, identified only as Sascha L., had carried out two successful tests of a home-made explosive device in his hometown in January.

An inquiry found two videos of the accused pledging allegiance to Islamic State’s leader. However, the court ruled on Monday that there was no evidence that the man had a personal connection with the Islamist militia or that he was financially supported by the militia, German broadcaster NDR reported.

NDR said the court granted him leniency since he cooperated with authorities after his arrest and confessed his plans.

German magazine Der Spiegel had reported that the man was part of the far-right scene in the past before converting to Salafism, an ultra-conservative Islamist creed.

The man, who was arrested in February, admitted planning an attack. Chemicals that could be used to make explosive devices were found during a search of his home in the town of Northeim in central Germany.

Three men charged as accomplices of the convicted man also appeared before the court. Two were convicted, with one sentenced to three years probation and the other to 100 hours of community service. The third person was acquitted.

Last week, German police raided nine locations in Berlin and the eastern state of Saxony Anhalt in an investigation of four people suspected of planning an Islamist-motivated attack.