BEIRUT, Lebanon — Syrian military defectors killed at least eight members of the security forces on Wednesday in an ambush near the city of Hama, in central Syria, according to opposition groups.

The attack was in retaliation for the killing of five people earlier Wednesday by the security forces, who hit their car with a tank as it drove through the village of Khattab, near Hama, the Syrian Observatory for Human Rights said in a statement. An opposition activist said that the men in the car were believed to be armed fighters.

In response, the defectors attacked four military vehicles at an intersection near the village of Al Asharneh, on the outskirts of Hama, said the human rights group, which is based in London. A resident of Hama said that the attack took place on a supply route linking Hama to troops fighting military defectors in the northern province of Idlib, near the Turkish border.

The antigovernment fighters attacked the convoy with rocket-propelled grenades and gunfire, killing eight soldiers, before disappearing, said an opposition activist who spoke on the condition of anonymity for fear of reprisal.