Militants attacked two Syrian security offices in the western city of Homs on Saturday with guns and suicide bombers, killing at least 42 people including a senior officer, a war monitor said.

The attackers killed the head of military security and 29 others at one of its headquarters in the city and 12 more people at a branch of state security in attacks that began early in the morning, said the Syrian Observatory for Human Rights.

Syrian state television reported that clashes had rocked the districts of al-Ghouta and al-Mohata, where the two targets were located, before three suicide bombers detonated their explosives at each place.

It said that the attacks had killed 32 people including General Hassan Daaboul, the head of the military security branch.

The jihadist rebel alliance Tahrir al-Sham said in a social networking post that five suicide bombers had carried out the attack but it stopped short of explicitly claiming responsibility.

"Five suicide bombers attacked two branches of state security and military security in Homs… thanks be to God," the group said in a statement on the Telegram social network.

Tahrir al-Sham was formed earlier this year from several groups including Jabhat Fateh al-Sham, which was formerly known as the Nusra Front and was al Qaeda’s Syrian branch until it broke formal allegiance to the global jihadist movement in 2016.

Since it was formed, Tahrir al-Sham has fought other rebel groups, including some that fight under the banner of the Free Syrian Army, as well as a faction linked to Islamic State, in northwest Syria. It was critical of FSA groups for taking part in peace talks.

Islamic State, which on Friday carried out a suicide bombing near the town of al-Bab in northwest Syria, has also carried out attacks in Homs before.

Homs is under the control of the government of President Bashar al-Assad except for one district which is held by more moderate rebels.

(Reporting by John Davison and Angus McDowall; additional reporting by Ahmed Tolba in Cairo and Kinda Makieh in Damascus; editing by David Clarke and Hugh Lawson)