BEIRUT — A car bombing north of a Syrian town just captured from the Islamic State group by Turkish forces and Syrian opposition fighters killed at least 35 people Friday, mostly civilians who had gathered trying to go back home, Turkey’s news agency and Syrian activists said.

According to Mohammed al-Tawil, a leading Syrian opposition fighter in the area, a suicide attacker blew up his small pickup truck outside a security office in Sousian village, about 8 kilometers (5 miles) north of al-Bab.

The explosion went off as the opposition fighters were organizing the return of civilians from al-Bab who had been displaced by the fighting for their town, he said.

Al-Bab, which had been controlled by IS since late 2013, was captured on Thursday, after more than two months of fighting led by Turkish troops supporting Syrian opposition fighters.

IS militants who withdrew from the town still control areas around it.

“A small civilian pickup truck reached the gathering and went off at the security checkpoint,” al-Tawil said over the telephone from Sousian.

Al-Tawil, a member of the opposition al-Bab military council, said about four fighters manning the checkpoint were killed in the attack. Al-Tawil, who was at the security office at the time of the explosion, said the rest of the casualties were civilians from al-Bab.

The Syrian opposition-run Qasioun news agency put the death toll at 45 while the Britain-based Syrian Observatory for Human Rights said 42 were killed.

Anadolu news agency said at least 41 of those wounded in the attack were taken to the Turkish border town of Kilis, where they are being treated in a state hospital. Some of the wounded were in serious condition, the agency said.

The Sousian security office was in charge of issuing permits and providing an escort for civilians wishing to return to al-Bab. Al-Tawil said at least two groups of about 150 civilians had already left early Friday for al-Bab, accompanied by a minesweeping unit operated by the Syrian opposition fighters.

“These people have suffered a lot … it was very difficult, and they have been waiting for this moment” to return home, al-Tawil said.

The Observatory said at least seven opposition fighters were killed in the town from land mines left behind by IS — a trademark of retreating militants.

Al-Bab had a prewar population of about 60,000, many of whom were displaced in neighboring areas, including during the most recent clashes.

Footage emerging from al-Bab showed a deserted town, badly damaged by the war. At least one of the streets appears completely destroyed, with buildings crumbling or leveled on both sides. Trenches and earth berms have made other streets impassable, and nearly every building shows some signs of artillery shelling or heavy machine-gun fire.