JERUSALEM — The Israeli military said it killed four militants linked to the Islamic State on Sunday after they attacked Israeli forces in the Golan Heights.

The confrontation appeared to be the first of its kind between Israel and Islamic State-affiliated forces based in Syria. It was not immediately clear if the militants’ attack had been spontaneous or if it signaled a possible change of policy by extremist groups.

Lt. Col. Peter Lerner, a spokesman for the Israeli military, described the exchange as “unique” in magnitude. He said jihadist fighters, riding in a vehicle with a machine gun mounted on its roof, had assaulted an Israeli reconnaissance unit with gunfire and mortars on the Israeli-controlled side of the contested territory.

Prime Minister Benjamin Netanyahu of Israel said the soldiers had “successfully repelled an attempted attack on the triangle of borders,” or the point where Israel, Syria and Jordan converge. Using the Arabic acronym for Islamic State, he added, “We will not let Daesh elements or other hostile elements use the cover of the war in Syria to establish themselves next to our borders.”