An Israeli court sentenced a 23-year-old Arab-Israeli citizen, Ahmed Shurbaji, to 22 months in prison Monday for going to Syria and fighting alongside the Islamic State group. The verdict sets a precedent, according to Haaretz, that Israeli citizens who go to Syria, receive military training and fight with extremist groups are a danger to Israel’s national security.

“Going to an enemy country for military training, especially Syria and most especially for training with Islamic State, is an offense that poses a great threat to Israel’s security,” according to court documents, via Haaretz. “A country that is defending itself must not wait for the threat to go from theory into practice."

Shurbaji crossed into Syria from Turkey “illegally with several others and with the help of people smugglers,” according to Agence France-Presse. The investigation showed he left for Syria in January, met up with a rebel group that goes by the name “Army of Mohammed” and was recruited to the group also known as ISIS within a week. He was immediately arrested upon his return to Israel’s Haifa district on April 20, but only after he allegedly received a weeklong military training and religious instruction in Syria.

During his time in Syria, Shurbaji reportedly fought alongside ISIS militants in several battles against Syrian President Bashar Assad’s forces. Shurbaji’s lawyer reportedly made the case that the 23-year-old was aiding rebels fighting an enemy of the state of Israel, according to Haaretz.

Four days before his return to Israel, Shurbaji reportedly contacted Israeli security officials and said he wanted to return home. He said he had made a mistake, according to the Jerusalem Post.

Shurbaji’s case highlights the dangers posed by ISIS’s rampant recruitment in countries all over the world. Foreigners who leave their home countries to join extremist groups then return home with military training and jihadist ideology. ISIS has also called on foreigners who have pledged allegiance to carry out lone-wolf attacks in their home countries. More than 15,000 foreigners have gone to Syria to fight with ISIS and other extremist groups, according to a United Nations report released last week.