BERLIN (AP) — A court in Germany has convicted a German-Algerian man of supporting the Islamic State group by helping members communicate on social media and sentenced him to four years in prison.

The Stuttgart state court said the 34-year-old, whose name it didn’t release, was convicted Friday of supporting a foreign terrorist organization as well as seeking members or supporters for a terror group. It said the defendant confessed to the allegations against him.

The court found that, from 2015 to 2017, the man was in contact from his home in Heilbronn with IS members in Syria and Iraq, providing them with cellphone numbers for accounts on WhatsApp and Telegram and setting up their profiles on Facebook and Twitter. It said he later belonged to a group that spread IS propaganda online.