BEIRUT, Lebanon -- After the Islamic State of Iraq and Syria scored stunning advances in northern Iraq last week, fast changes have been unfolding in Syria that could change the balance of power in the country’s uprising-turned-civil war, now in its fourth year.

Tens of thousands of Shiite Muslim mercenaries from Iraq, who have been fighting alongside Syrian troops against the mostly Sunni rebels, are leaving the Syrian war and going home to fight ISIS. Making up for the vacuum, the Lebanese Shiite militia Hezbollah is already bolstering its presence in Syria to support Bashar Assad regime troops.

That shift of forces following the ISIS rout in Iraq is also making for some unexpected alliances.

The U.S. and the West are on the same side, as is al Qaeda affiliate Jabhat al Nusra, which also has been fighting ISIS for months over territorial control.

Secretary of State John Kerry told Yahoo's Katie Couric, "I think we are open to any constructive process here that could minimize the violence, hold Iraq together — the integrity of the country — and eliminate the presence of outside terrorist forces that are ripping it apart." He cautioned, "Let’s see what Iran might or might not be willing to do before we start making any pronouncements."

The Assad regime, along with the Iraqi government in Baghdad, the Iranian regime and Hezbollah, all dominated by Shiites or the related Alawite sect, suddenly find themselves fighting on the same side as the Sunni rebels who oppose ISIS, with whom they are locked in a turf war for control of Syrian areas taken from government troops. 

The government of Syrian President Bashar Assad may also be playing a duplicitous game with ISIS, allying itself with it to take advantage of the group’s willingness to fight other rebels.

“It’s a logical strategy for Assad. ISIS fights Syrian rebels, so the enemy of my enemy is my friend,” one diplomat close to Assad said on condition of anonymity due to the sensitivity of the subject.

Syrian rebels who for months have been fighting both ISIS and Syrian troops are stunned at the swift ISIS advances in Iraq, and the extent of support that the group turned out to have among Iraqi Sunni clans who greatly facilitated its victories in the past days. They are looking for ways to exploit that to their advantage.

“The fighting (with ISIS) has all but come to a halt as we assess the situation, because now ISIS is trying to strengthen itself from Iraq, and so are we,” said Jassem al-Forati, an activist who works closely with rebels in Deir al Zor province in eastern Syria, which borders Iraq. He added that Syrian rebels, including Jabhat al Nusra, have gotten their hands on American weaponry looted  from Iraq last week, after the army abandoned its posts and its equipment -- much less, however, than what ISIS has managed to loot.

Deir al Zor has been under siege by ISIS for 10 weeks as the extremist group demands Syrian fighters surrender their weapons, and pledge allegiance to it or die.

ISIS had been waging jihad in Iraq for a few years, taking credit for car bombings against the country’s Shiite majority and vowing to topple the Shiite-led Maliki government. It expanded into Syria early last year, and was initially welcomed by Syrian rebels as an ally in the fight against the Assad regime.

But ISIS quickly adopted a parasitic strategy, whereby it would forcibly move into territory that rebels had gained from Syrian troops. The most striking example of this is the province of Raqqa, first “liberated” from the Syrian government by rebels in March of last year before ISIS took it over and established its own rule, inspired by a narrow, medieval interpretation of Islamic law.

The group has horrified locals with public beheadings and crucifixions, often targeting other rebels, civil activists and journalists. So extreme is ISIS that al Qaeda head Ayman al-Zawahiri issued a few weeks ago a public statement denouncing the group for its violence.

In the past few days alone, ISIS posted horrendous footage of mass executions which the Baghdad government says it has verified to be the “liquidation” of some 1,700 Iraqi soldiers, most presumed to have been Shiite.

That level of brutality against forces loyal to Prime Minister Nouri al-Maliki, an Assad ally, as well as the threat ISIS poses to Iraq’s national unity, may also end any Faustian alliance between ISIS and the Syrian government.

For now, the deal may be holding. This weekend the Syrian air force bombarded for the first time ISIS strongholds in the provinces of Raqqa and Deir al Zor, though without any reported casualties, according to the London-based Syrian Observatory for Human Rights. Locals in Raqqa said ISIS fighters inexplicably cleared out of their barracks 24 hours before Syrian warplanes bombed. In Deir al Zor, some rebels say warplanes that bombed ISIS positions seemed to fly in and out of Iraqi airspace, in an apparent collaboration with Iraq.

Rebel sources in Deir al Zor also said they have been noticing “five to six commercial airliners flying overhead for the past few nights” into Iraqi airspace from Syria. Those may be planes carrying Iraqi fighters back home: an estimated 20,000 to 30,000 Iraqi Shiite mercenaries who have been fighting in Syria alongside Assad troops are now returning home to fight ISIS in Iraq.

Already, some Syrian rebel brigades have exploited the sudden vacuum left behind by the Iraqi paramilitaries along front lines. Rebels made some advances, namely near the Syrian capital in the Qalamoun area, where they launched a surprise attack on government troops over the weekend, resulting in numerous casualties.

However, rebels expect new reinforcements to arrive from the Shiite militia group Hezbollah to try to make up for the Iraqi loss.

“Hezbollah is fast stepping in to fill this vacuum,” a rebel fighter said via Skype, on condition of anonymity.

Corrupt, decimated by defections and weary with battle fatigue, Syrian forces have relied heavily on their allies from Lebanon and Iraq in their fight against the rebels. Hezbollah has been openly fighting alongside Syrian troops for months, with an estimated 5,000 militiamen in Syria at any one time.

But with rising casualties and a constant threat of spillover of violence from Syria, Hezbollah is facing mounting pressure from Lebanese politicians, as well as internal dissent for its ongoing involvement in the conflict. Now, the Iraqi departure from Syria may further stretch the group, which already endured at least two dozen casualties in the past couple of days, according to sources.

The threats issued by ISIS against all Shiites, including the sect’s holy city of Karbala in southern Iraq, raises alarms of an existential threat for Hezbollah, which recognizes all too well it could be targeted by a wave of suicide attacks in its own headquarters in southern Beirut. Hezbollah endured several such attacks late last year, resulting in numerous civilian fatalities in the Shiite stronghold of Dahyeh.

According to reports based on leaks in local media outlets, Hezbollah has already set up an operations room to deal with the Iraq fallout, and has mobilized some 30,000 battle-ready fighters.

Back in Syria, rebels have recently made small gains against government forces, for example around Damascus. In other parts of the country, like along Syria’s coastal frontline, a different scenario has unfolded over the past couple of days. Rebels there had been defending newly gained territory to the north since March. But this weekend, the rebels withdrew in order to solidify their ranks against ISIS in Deir al Zor and maintain their control over some parts of Iraq’s border, seen as essential to the rebels’ survival.

Also in Deir al Zor, where ISIS has tightened the noose around the besieged provincial capital, the predominantly Sunni population there is bracing for what some fear is the inevitable defeat to ISIS.

One local resident, who would give his name only as Adnan, saw a silver lining in the latest developments, as everyone in the warring region finally seems united against a common enemy.

“At least now ISIS will finally endure Assad’s aerial bombardment, and the regime’s brutality, just like the rest of us,” he said.