Earlier this month, a U.N. observer force crossed from the Israeli-occupied Golan Heights into Syria. (Jalaa Marey/AFP/Getty Images)

Israeli forces engaged in a brief but deadly fight Sunday against Syrian militiamen allied with the Islamic State, killing four militants in the fraught borderlands of the Golan Heights.

It was the “first substantial fight” between Israeli soldiers and an Islamic State affiliate in the long-running Syrian war, said Lt. Col. Peter Lerner, an Israeli military spokesman. No Israelis were injured.

Although there have been dozens of cases of errant and intentional artillery, mortar and small-arms fire from Syria toward Israeli-controlled territory in the occupied Golan Heights, this exchange involved the group known as the Yarmouk Martyrs Brigade, whose leaders publicly pledged their allegiance to the Islamic State in 2014.

About 9 a.m., a reconnaissance unit from Israel’s Golani Brigade was patrolling along the cease-fire line, the military said, outside the Israeli-built fence. The Israeli troops were confronted by the Syrian militants, who deployed small arms and mortars, and the Israelis responded, the military spokesman said.

The Israeli air force spotted a vehicle armed with a heavy machine gun and destroyed it with a rocket, killing four occupants, Israel said.

Israel has pledged to stay out of the Syrian conflict but has also vowed that it will respond to any threats made against Israelis in the Golan Heights.

In June, the State Department designated the Yarmouk Martyrs Brigade a “global terrorist entity.” The group is composed of local clans in southern Syria. Israeli military intelligence officers say there are few, if any, outsiders or foreign fighters in its ranks.

The brigade was formed in 2012 and has staged attacks throughout southern Syria, often along the Israeli and Jordanian borders, the State Department said.

In 2013, the group abducted 25 Filipino U.N. peacekeepers who patrol the disputed border between Israel and Syria in the Golan Heights. The peacekeepers were eventually released.

The group has fought alongside and against the rebels in Jabhat al-Nusra. Earlier this year, the militants changed the name of their brigade and allied with another group also affiliated with the Islamic State.

Nitzan Nuriel, former director of the counterterrorism bureau at the prime minister’s office, said he did not think the attack against the Israeli soldiers represented a new Islamic State-directed offensive against Israel.

“I think the decision to open fire against our soldiers was a local decision,” he said. “It was not something ordered by a high command.”

Nuriel said Israel’s response was appropriate and repeated the message, “Don’t mess with us.”

Prime Minister Benjamin Netanyahu commended the troops. “We are prepared against any enemy that threatens us on our northern border,” he said.

Israel essentially annexed the Golan Heights in 1981 when it extended Israeli civil law — versus military rule — to the territory it seized from Syria during the 1967 Six-Day War.

The international community, including the United States, has never recognized Israel’s annexation of the area and views it as Syrian territory occupied by Israel.

In April, Netanyahu declared that Israel will “forever” retain full control of the mountainous plateau and will never return the strategic highlands to neighboring Syria.