Flag of Germany
Flag of GermanyiStock

A German court on Thursday jailed three young German men for up to four and half years for travelling to Syria where they teamed up with jihadists.

Fadil Rudolf S., 26, who received the longest prison term, had first travelled to Syria to join the Sunni group Junud al-Sham and in 2013 joined fighters of the Islamic State (ISIS) group, reported AFP.

"After his first return to Germany, he once again made himself available as a fighter for ISIS over several weeks in July 2014," the court in the western city of Duesseldorf said in a statement quoted by the news agency.

"Later in January and in the summer of 2015, he also sought twice to travel to Syria to join ISIS."

The other men, 24-year-old Mohamed A. and 26-year-old Mustafa P., were sentenced to two years and nine months for involvement in Junud al-Sham for several months in 2013.

"The confessions of the accused had a mitigating effect on their sentences," the court statement said.

Separately, reported AFP, prosecutors in the southwestern town of Karlsruhe decided to detain a 27-year-old man, Ashraf Al-T., who they suspect of having contacts with an ISIS member in Syria who runs the group's foreign operations.

The man is thought to have been "authorized to plan an attack in Germany", prosecutors said without elaborating.

He was arrested Wednesday evening in Berlin. He said he was a Syrian asylum seeker who arrived in Germany last year, but prosecutors did not specify his nationality.

German security services have been on high alert in recent months over the possibility of Islamist attacks.

In October, a Syrian refugee was arrested on suspicion of planning a major attack in Berlin after police discovered explosives in his apartment.

The man, Jaber Albakr, was later found dead in his cell after an apparent suicide.

Germany was targeted by a series of attacks this past summer, including two in the southern state of Bavaria that were both claimed by the ISIS.

In the first attack, a 17-year-old Afghani with an ax attacked passengers on a train in Wurzburg before being shot dead by security forces.

In the second incident, an attacker set off a bomb in a restaurant in Ansbach, killing himself and wounding 12 others.

According to figures released in May by German intelligence services, 820 jihadists have left Germany for Syria and Iraq.

Almost a third have returned and 140 were killed while abroad, while around 420 are still in Syria or Iraq.