For the past two years, rebels in the northern Aleppo town of Marea have repeatedly fought off attempts by the so-called Islamic State to take control of the area. Last week saw them successfully break the group’s siege and force it to withdraw.

The town of Marea in northern Aleppo was transformed into a battlefield last week as rebel forces clashed with the so-called Islamic State. Rebels forced out the militants and displaced residents returned to their homes on Wednesday after more than a week of assaults and sieges.

This was not the first time ISIS failed to seize Marea; rebels have repeatedly rebuffed the group’s advances on their strategically important town. However, ISIS was determined to win in this latest attempt, deploying some of its elite fighters and most powerful weapons. But a little over a week into the offensive, ISIS unexpectedly withdrew, lending credence to reports that the group may be struggling.

“It seems they [ISIS] can’t keep several fronts open at the same time. It is a strategic area; they were on the verge of entering Azaz,” director of the U.K.-based Syrian Observatory for Human Rights, Rami Abdulrahman, said shortly after the group’s withdrawal, referring to the strategically important rebel-held town just 4 miles (7km) from the Turkish border.

On May 28, ISIS launched a wave of attacks on Marea, capturing five nearby towns and besieging the area on three fronts – the first part of its plan to gain full control over the town. “ISIS brought Jaish al-Fatiheen, Jund al-Khilafa and Said al-Khilafa,” Hussein Nasser, director of the media office of Al-Mutasim Brigade, the leading rebel faction in the town, told Syria Deeply. “Those are the group’s most prized fighters. All of them are trained in using heavy weaponry and all of them are willing to blow themselves up.”

In this latest assault on the city, rebels captured a number of ISIS fighters, who told them the group sent around 1,200 fighters, four tanks, a Russian-built BM-21 “Grad” multiple rocket launcher, and 10 cars filled with explosives, Nasser said.

Despite this show of force, various rebel factions joined forces and, reportedly with the help of the U.S.-led coalition, were able to break the ISIS-imposed siege and drive the militants out. “The reason why Marea was able to successfully defeat ISIS time and time again is because the rebels fighting in the town are all locals, and all have an emotional bond with the town and its residents,” Nasser said.

Some 1,500 fighters joined the counterassault from various major rebel groups including Al-Mutasim Brigade, the Levant Front, an Aleppo-based group affiliated with the Free Syrian Army, and the 13th Division, a rebel group backed by the Syrian National Council, the opposition’s main political wing. The rebels were supported by local residents.

“Civilians in Marea could never accept the ISIS presence in their area, as it has shelled their homes, and sometimes used them as human shields,” said Nasser. “Even during the battle, there were either those who volunteered to fight alongside us [the rebels], or civilians who helped rebels by offering them food and shelter. Women have also fought alongside rebels against the militants. Even though we don’t encourage putting women at the frontline, some insisted.”

For the opposition, part of the importance of Marea lies in the fact it is the hometown of Abdulqadir al-Saleh, founder of Al-Tawhid Brigade, a faction responsible for sizable military gains for rebels in the north. It is also the largest town in the northern Azaz district of the Aleppo governorate.

“Marea was one of the first towns in northern Aleppo to be announce its opposition to the regime and to be seized by rebels,” Nazeer al-Khateeb from Aleppo’s Shahba Press told Syria Deeply. “ISIS has been attempting to storm into Marea for the past two years. They want revenge for the 1,500 or more fighters it lost at the hands of rebels in its previous attempts to seize the town.”

In August 2014, ISIS fiercely attacked armed rebels in Marea, seizing 13 villages in the area and coming very close to seizing the town. A year later, ISIS was once again defeated by rebels when it launched an assault on Marea after capturing the neighboring village of Um Hosh, located on the road between Aleppo and Marea. The assault cost the terror group 25 fighters.

Unlike previous battles, rebels reportedly received aid from international powers in this latest counterassault. The U.S.-led coalition, which includes Turkey, trained and armed Al-Mutasim Brigade in its fight against ISIS. Prior to the siege of the town, the coalition gave rebels enough weaponry and ammunition to successfully battle the militant group.

Reports surfaced that the coalition airdropped weapons that helped rebels during their battle with ISIS, but Nasser said no weapons were airdropped on the area after the siege, although the coalition did drop ammunition. Khateeb also denied reports the U.S.-led coalition wrongfully targeted and killed a number of the rebels it was backing in Marea, claiming the incident was a miscommunication.

The coalition also played a second role in the defense of Marea. When ISIS besieged Marea, rebels reached an agreement with U.S.-backed Kurdish forces that would allow the latter group to maintain its control of Sheikh Isa in exchange for opening the Marea road for civilians fleeing the battlefield.

Thousands of others were forced to flee towards nearby Ifrin and Sheikh Isa when ISIS encircled Marea. The closest estimate for the number of families who fled was 1,000, while 500 insisted on staying either because their family members were fighting with the rebels, or because they feared not being able to return to their homes, Khateeb said.

Despite recent U.N. reports that Kurdish forces turned back fleeing residents from entering areas under their control on the Marea road, Khateeb said the Kurdish rebels welcomed displaced Syrians from Marea, and even offered medical assistance to injured rebels.

On June 8, rebel forces successfully broke the ISIS siege and civilians were allowed to return to the town, Khateeb said. “Once the rebels broke the siege, we saw buses and trucks carrying families back to their homes.