MANILA — Militants linked to the Islamic State attacked a group of soldiers on the southern Philippine island of Jolo, setting off a clash that left two children dead, the military said on Sunday.

Six militants from the insurgent group, known as Abu Sayyaf, were also killed in the gun battle on Saturday in a remote village near the town of Patikul, in Sulu Province, the military said. Five soldiers and two civilians were wounded.

The soldiers had been sent to the area, where local Islamist insurgencies have long battled the state, to discuss development projects with village elders. While those discussions were underway, they were attacked by about 30 Abu Sayyaf militants.

Capt. Jaime Abibas of the Philippine Army’s Special Forces unit said the troops had held off the militants and tried to protect villagers who were caught in the crossfire.