“GOOD morning!” beamed the presenter on Syrian television. “The morning of democracy!” replied a jovial correspondent at a polling station, as Bashar Assad, Syria’s president, went to the ballot box on June 3rd. Winning a third seven-year term with 89% of votes cast, Mr Assad hopes that the election, which took place only in the half of the populated territory that his forces more or less control, will give his regime fresh legitimacy. More to the point, it demonstrated that he has been holding ground militarily and may even have begun to turn back the rebel opposition’s territorial tide.

Progress has been slow, but over the past nine months or so the regime has advanced on the ground, thanks largely to Hizbullah, the Lebanese Shias’ militia, to assorted mercenaries and to an Iranian-trained parallel army known as the National Defence Force. A year ago the rebels were driven out of Qusayr, on the border with Lebanon. By March this year they had been evicted from Qalamoun, cutting a rebel supply line. Now they are in danger of being strangled in Aleppo, the northern city that has been divided between the regime and rebels for the past two years.

The regime’s forces rely on foreign support (mainly from Iran and Russia) and brutal tactics, including the use of sarin gas and barrel-bombs against civilians and the banning of aid crossing into Syria from Turkey. But Mr Assad has other advantages, too. He has a clearer strategy than the opposition’s. He has more consistent as well as more generous backing from his allies. And he is not hamstrung by the internal divisions from which the rebels suffer.

For the past six months or so, the rebels have been diverted from their war against Mr Assad by having to open a second front against the Islamic State of Iraq and Greater Syria (ISIS), the most extreme of the jihadist groups and the one that has inducted the biggest number of foreigners. Even Jabhat al-Nusra, which al-Qaeda has blessed as its main affiliate in Syria, has been fighting against ISIS.

The presence of jihadists had previously deterred potential supporters in the West and in the Gulf from sending in more military aid, since they were unsure where it might end up. Turkey, which controls the main supply routes to the rebels, closed three crossings held by ISIS. It also blacklisted Jabhat al-Nusra as a terrorist group.

More recently, however, the mainstream rebels’ allies—chiefly the United States, Britain, France, Qatar and Saudi Arabia—have begun to expand their efforts to help those they consider worthy of support. They have been chuffed by the rebels’ war on ISIS. And they are co-ordinating efforts to help them better. An increasing number of vetted fighters in both the north and south of Syria have been trained in Jordan, Qatar and Saudi Arabia, given money to pay salaries, and supplied with anti-tank weapons, albeit so far in limited quantities. Meanwhile, Gulf donors are said to have cut off funds to some of the more zealous Islamist groups, including the Islamist Front, a coalition dominated by Ahrar al-Sham, a Salafist outfit.

As a result, the rebels, especially those who have been getting renewed support, have made small advances—in northern Hama province, in southern Idleb and western Aleppo, as well as in Quneitra, close to the border with Israel. The aid that has lately been given has been too little to shift the national balance of power markedly, but it has altered the dynamic among the rebels. Moderate groups that did not exist before, such as Harakat Hazm, or which had almost been extinguished six months ago, such as the Syrian Revolutionary Front, have been revived and bolstered.

At the same time other groups, including Islamist ones, have been scrambling to portray themselves as more moderate. On May 17th a coalition of them signed a document of principles. “The aim is to restate the original goals of the revolution—to topple the regime and to win freedom,” says Muhib al-Deen al-Shami of the Islamic Front’s political office in Istanbul. A southern front, an alignment of moderate groups from Damascus and farther south, has also drawn up a code of ethics.

From the point of view of Western governments, especially the American one, the biggest worry is that the civil war could lead to a spread of terrorism—back home as well as in Syria. Hence their keenness to see ISIS pegged back by more moderate rebels. Since January ISIS has been pushed out of Idleb province and Aleppo city, and has had to withdraw to the countryside east of that city and back to its stronghold in Raqqa, farther east, the only provincial capital entirely out of Mr Assad’s hands.

ISIS, for its part, has barely been battling against the regime while it sets up an intelligence force and tussles with rival insurgents for Deir ez-Zor, another eastern city; indeed, there are signs that it tacitly co-operates with Mr Assad’s regime. Some anti-ISIS rebel groups reckon up to half of their forces have been diverted to this second front. ISIS is buoyed up by huge ransoms for journalists it has kidnapped. When it has clashed with government forces, its aim has been to capture weapons rather than territory. “These are the days of criminals,” says a pharmacist in Deir ez-Zor. “Assad and ISIS are winning.”

Obama still scratches his head

The biggest question-mark hangs over the intentions of the opposition’s main backers, especially America. “A strategic approach would involve increasing support to credible non-ideological groups,” says Noah Bonsey of Crisis Group, a Brussels-based think-tank. But American policy is still undecided. Before giving a much-heralded foreign-policy speech on May 28th, Barack Obama is said to have wobbled yet again over assisting the rebels. By one analysis in Washington, the aim is to give the rebels enough aid for them to act as an effective counter-terrorism force against groups such as ISIS, but nothing like enough to tilt the balance definitively against Mr Assad. “It has to be creating an army or nothing,” complains David Richards, the retired head of the British armed forces.

If the rebels continue to get only light arms, a few anti-tank and—crucially—no anti-aircraft weapons, the battle lines are likely to become more entrenched, in effect partitioning the country. Separate slices of territory may be controlled by rival factions, including ISIS, Jabhat al-Nusra and the Democratic Union Party, known by its Kurdish initials, PYD, which appears to be co-operating with Mr Assad and controls slabs of the north. Jabhat al-Nusra has grown in the south partly because it can pay fighters salaries of $100-200 a month.

So a bloody mess persists, with nobody winning. Many Syrians in Damascus loathe the regime, but do not much prefer the opposition, which they consider to be tarnished and losing, or at least not winning, on the battlefield. Above all, many Syrians now want the war to cease at almost any cost. “At the end of the day we understand people need to eat,” says Abu Hamza, leader of a rebel group in Qaboun, a suburb of Damascus, explaining why fighters join extreme Islamist groups such as Jabhat al-Nusra. That brutal truth, rather than the fake legitimacy afforded by this week’s bogus election, is one reason Mr Assad is still in power.