BEIRUT (AP) — As President Bashar Assad seeks to reassert his authority in Idlib, the only remaining province in Syria where his forces have almost no presence, he may be aided there by deep fractures within al-Qaida, the militant group that dominates the region.

A recent wave of detentions and a spate of violence within al-Qaida have also raised fears of an all-out war between insurgents in the heavily populated province near Turkey as Assad's forces make their push.

Assad lost control of Idlib nearly three years ago and he has vowed to recapture it, but that is expected to be a bloody and costly fight. The militant haven is heavily fortified and home to thousands of fighters who transferred there from other parts of the country. It is also where tens of thousands of civilians settled after fleeing fighting in Aleppo, Homs, the suburbs of Damascus and elsewhere.

Tensions inside Idlib have been on the rise for months, reflecting a power struggle between hard-line foreign fighters loyal to al-Qaida's leader, Ayman al-Zawahri, and its more moderate Syrian members.

The tensions worsened in late November after a wave of detentions by an al-Qaida-linked group against more extremist, mostly non-Syrian members. Among those detained were two of al-Qaida's most esteemed leaders and founding members of the extremist group's branch in Syria, who were set free days later after pressure by factions within the group who threatened to withdraw from the battlefield in protest.

The Nov. 27 raids by the al-Qaida-linked Hay'at Tahrir al Sham — Arabic for Levant Liberation Committee, also known as HTS — took many by surprise and angered al-Zawahri, who accused his top man in Syria of betrayal.

The detentions, ordered by HTS leader Abu Mohammed al-Golani, were the clearest indication yet of the sharp divisions within the international terror network. They also come as al-Golani appears to be edging closer to Turkey, which is trying, along with Iran and Russia, to bring an end to the country's civil war, now in its seventh year.

HTS was until recently on the ascendant in Syria, crushing potential opponents in Idlib as its rival, the Islamic State group, faced significant setbacks, losing most of the territory it once held in the country.

Those who were detained included Jordanian citizens Sami Oraidi, al-Qaida's former top religious figure in Syria, and the highly secretive former military commander in southern Syria, Ayad Toubasi, also known as Abu Julaybib al-Urduni, brother-in-law of the late al-Qaida in Iraq leader, Abu Musab al-Zarqawi.

After their detentions, other al-Qaida officials, including a prominent cleric, went to ask al-Golani why their comrades were detained. But the men ended up being taken into custody themselves.

"The campaign of arrests against our brothers and cadres will not stop us from continuing our struggle against the enemies of God and will open for you a door that you will wish you never opened," a Syria-based al-Qaida commander, Abu Humam al-Shami, who is opposed to HTS, warned earlier this month.

Days after al-Shami's warning, intense clashes broke out between HTS and the Jund al-Malahem faction that split from it in October and is close to the detained al-Qaida officials, leaving at least seven people dead.

"There are widespread concerns of a full-blown confrontation between the two sides," said an opposition activist in northern Syria who lives in areas controlled by HTS. Speaking by telephone, he asked that his name not be made public for fear of reprisals by the militants.

The activist said that dozens of other members and commanders, including one known as Abu Khadija who used to run al-Qaida's notorious al-Iqab prison, were also detained.

"It is clear that the jihadist movement in Syria is suffering probably the worst moment of internal fighting since the 2013 schism between ISIS and Jabhat al-Nusra," said Jennifer Cafarella of the Washington-based Institute for the Study of War, using an alternate acronym for the Islamic State group. Jabhat al-Nusra or the Nusra Front was the predecessor of HTS before it changed its name.

Oraidi and Toubasi were released after pressure by two of HTS's most powerful armed wings, which were on the verge of withdrawing from the fight against Assad's forces if the two were not released, according to Assem Zeidan of the Turkey-based Jabhat al-Nusra Violations group that traces al-Qaida's atrocities in Syria.

HTS said in a statement that the detainees, whom it did not identify, have "ruined the foundations" of the organization it said was dedicated to "setting up a Sunni entity that gathers all the powers of the people of the Levant to fight the enemy and represent the people of Syria." It did not say what their offenses were.

The detentions angered al-Zawahri, who released an audio recording in which he accused HTS and al-Golani of "betraying the vow of allegiance," adding that al-Golani's decision to break ties with al-Qaida last year had weakened the international terror network.

The move, in which Syria' al-Qaida branch, known at the time as the Nusra Front, cut all ties with the international terror network, was seen by many as an attempt to improve its image. Months later, it formed and led a coalition consisting of several militant groups that became known as HTS, and crushed most rival groups in areas it controlled.

Ahmad Hamade, a Syrian army colonel who defected early in the conflict, said that HTS is more tolerated in northern Syria, where al-Qaida's more extremist factions are usually not welcomed. In fact, many HTS fighters were members of the Free Syrian Army, the mainstream rebels fighting to topple Assad, he said.

Cafarella said that what happened over the past year with al-Qaida in Syria was that al-Golani, "a forward-leaning, visionary subordinate, told his skeptical boss (al-Zawahri) to just trust him and let him implement his vision for the good of the organization."

"The subordinate failed to generate the promised outcome in acceptable time, however. The skeptical boss therefore reclaimed control," said Cafarella who closely follows jihadi groups in the Middle East.

For months, al-Qaida's branch in Syria has been witnessing rivalry between its mostly Syrian, relatively moderate members and the foreign fighters who remain loyal to al-Zawahri. The tension became more apparent after Turkey started sending troops into areas held by HTS in northern Syria in October, with some HTS members supporting Ankara's incursion and foreign fighters calling against it.

Asad Kanjo, an opposition activist from Idlib who currently lives in Britain, said that the divisions within al-Qaida's branch in Syria are the result of al-Golani trying to market himself as a Syrian leader who has no links to the international terror network.

"This is a purely Turkish move. Turkey wants the Syrian branch (HTS) to cut all links with the international organization," Kanjo said, paving the way for al-Golani to join the political process.

Hassan Hassan of the Tahrir Institute for Middle East Policy wrote recently that HTS seeks to establish ties with countries like Turkey in an attempt to become part of the solution.

"This will further push away hard-line jihadis and al-Qaida loyalists who have to make a decision about their fate in a country that is increasingly divided into spheres of influence of foreign countries," he wrote.