BEIRUT (Reuters) - Hundreds of civilians left a besieged Islamic State enclave in central Syria after the Syrian government and Islamic State reached an evacuation deal, the Syrian Observatory for Human Rights said on Friday.

The Syrian army could not be reached for comment but a Syrian military source quoted on state media later said that the army and its allies had captured several areas in the enclave.

An insurgent source in northwestern Syria said the civilians - mostly shepherds - from the enclave, straddling the border between Hama and Homs provinces, had arrived in rebel-held Idlib province.

The Syrian army - supported by Russian air power and Iranian-backed militias - isolated the pocket, Islamic State’s last presence in central Syria, in August during its eastward drive against the jihadists.

The military source said the army had captured the areas of Mazin al-Baqr, al-Mushirfa al-Shomalia, Rasm al-Tawil and Jawra al-Nazal, .

The Observatory reported that the government and Islamic State had finalised the deal on Thursday, allowing Islamic State fighters, their families and civilians to leave the pocket and cross government areas into areas held by Islamist groups.

Some crossed to areas held by Tahrir al-Sham, a jihadist alliance that includes the former Nusra Front group, in northern Hama and eastern Idlib provinces, it said. Others moved to camps set up west of the enclave in government-held areas in accordance with tribal deals, the British-based monitor said.

Last week, jihadists launched an offensive against government-held parts of northern Hama province, advancing south from rebel-held Idlib. The Syrian government has responded with strikes on rebel-held positions.

Russia, Iran and Turkey had previously struck a tripartite deal to deploy an observer force on the edge of a designated “de-escalation zone” in Idlib. The Islamist militants who hold sway in Idlib rejected the diplomatic effort.

The Syrian army’s main focus has been its offensive against Islamic State in the east of the country, where the Islamist group is also facing an offensive by the U.S.-backed Syrian Democratic Forces.