Thousands of migrants have been found trapped in camps in Libya the past days after they were caught amid the fighting over the northwestern city of Sabratha, officials said on Sunday.

Sabratha, a city on the western side of Libya’s Mediterranean coast that used to be the main launching point for migrant boats, has witnessed heavy clashes over the past two weeks. Hundreds were killed in the fighting and officials said that it was triggered by an Italian deal with one of the rival militias to stem the flow of migrants from Libya across the Mediterranean.

Over 4,000 migrants, including pregnant women and children, were found in the past two days in different locations in town, said Saleh Graisia, the spokesman for Anti-ISIS Operation Room. The group is now in control of the city of Sabratha.

Mr. Graisia accused the al-Ammu militia which struck a deal with Italy and Libya to stop trafficking of storing the migrants to smuggle them later. It wasn’t immediately possible to reach al-Ammu for comment.

Essam Karrar, the head of the Sabratha Civil Society Federation, said 1,700 migrants were found at the western edge of Sabratha, which used to be under control of al-Ammu, while the rest were scattered elsewhere. He said al-Ammu intended to deport the migrants.

The city is now “healing its wounds” after the fighting shattered families and brothers raised guns against each other.

“We the people in Sabratha were only tools in the hands of Europeans,” he said.

The deal with Italy led to a dramatic drop in migration from Sabratha but some in Libya feared the salaries and supplies would enrich the militias and make them more powerful. The boost to one side threw off the balance of power in Sabratha, triggering a backlash from other local militias.