BEIRUT/AMMAN (Reuters) - A bomb claimed by Islamic State at a Syria-Turkey border crossing killed at least 25 people, most of them foreign-backed Syrian rebels, and wounded dozens more on Thursday, witnesses said.

The British-based Syrian Observatory for Human Rights monitoring group put the death toll at least 21.

The attack targeted rebels from factions which have been battling the jihadist group with Turkish military support along another stretch of border further to the northeast, the witnesses and the Observatory said.

It took place on the Syrian side of the Atmeh crossing, west of Aleppo. A photo sent by a witness in the area, purportedly of its aftermath, showed the bloodied corpses lying on the ground.

Islamic State claimed the attack in an online statement.

The witness said most of the rebels were from the Failaq al-Sham group, which has been fighting alongside other Turkish-backed factions in Ankara’s offensive, dubbed “Euphrates Shield”.

That operation, taking place along the border northeast of Aleppo, has also targeted Kurdish militants.

The rebels use the Atmeh crossing to move between Idlib province, through Turkey, to the areas where anti-Islamic State operations are taking place, the Observatory said.

Residents told Reuters they also use it to evacuate wounded fighters.

Among the dead from the Atmeh blast were the head of the top civil judicial body in rebel-held eastern Aleppo, Sheikh Khaled al-Sayyed, and a judge who worked with him, a witness and a rebel official said.

Syria’s Idlib province, where Atmeh is located, is a bastion of the Turkey-backed opposition to President Bashar al-Assad’s rule. A multi-sided civil war has raged in Syria for more than five years.

Islamic State is fighting against all sides, including the Syrian government, foreign-backed rebels and other U.S.-backed fighters.

Aleppo, further to the east, has been divided for years between government- and rebel-held areas. The opposition have set up their own administrative bodies in the east.

Government forces have encircled eastern Aleppo in recent weeks in a battle separate to that with Islamic State, and seek to completely recapture the city, Syria’s largest before the war.