BEIRUT — Across the broad swath of territory they control bridging Syria and Iraq, extremist militants from the group known as the Islamic State have proven to be highly organized administrators. Flush with cash, they fix roads, police traffic, administer courts, and have even set up an export system of smuggled crude from oil fields they have seized.

But the extremists – a mix of Iraqis and Syrians but also foreign fighters from Arab countries and non-Arab regions like the Caucasus – run the risk of provoking a backlash from the people they have come to rule.

Unlike Lebanon’s Hezbollah or the Palestinian militant group Hamas, which have deep roots in their communities, the Islamic State group is not a grassroots movement and its sway over its populations is ultimately based on violence, not necessarily a groundswell of support for its vision of a hard-line Islamic caliphate.

While it has been welcomed by some disenfranchised Iraqi Sunnis as potential saviors from the Shiite-dominated government in Baghdad, many consider the group an alien entity.

In recognition of that, the group has varied the imposition of the radical version of Islamic law they advocate.

In their main stronghold in Syria, the city of Raqqa, they have unleashed it without reserve, killing perceived offenders and cutting off the hands of thieves in public.

But in Iraq’s second largest city, Mosul, they have been more cautious. They’ve taken some steps like banning alcohol and painting over street advertisements that show women’s faces – but have held off on strict punishments.

The leader of the Islamic State group appears to recognize that over the long term his fighters are not governors. In an address after the June 9 fall of Mosul, Abu Bakr al-Baghdadi appealed to Muslims around the world with practical skills – scholars, judges, doctors, engineers and administrators – to flock to the regions his group controls to help build the state.

Over the past month, the group has consolidated its hold over an impressive stretch of territory, 435 miles from end to end.

Among the first moves it took in parts of Syria that it captured were to set up various Islamic administrative departments staffed by its fighters and sympathizers: Islamic courts to settle disputes; “Hisba” offices, which enforce Shariah rules; and “Daawa” offices for proselytizing and spreading its ideology.

The showcase of the extremist group’s vision is Raqqa, a city of 500,000 in northern Syria along the Euphrates River. There, the militants have banned music and smoking and forced women to cover up.

They have killed violators of Shariah in the main square, including by beheadings, and have hung the bodies of some on crosses.

A photo posted online by the group this week showed fighters in the eastern Syrian region of Hassakeh punishing residents who broke the Ramadan fast: The men knelt on the ground as fighters stood behind them with canes to lash them.

Another priority has been to provide services. In Raqqa, the group pays wages to city employees, has rebuilt damaged power lines and has kept up water and electricity services. During the holy month of Ramadan, it has distributed food and other aid to residents in Raqqa, Iraq’s Mosul and other areas.

Photos posted by the group on Twitter show men in the long beards and white robes favored by hard-liners sitting behind a desk in a Raqqa mosque passing out cash to the poor.

The men even have printed applications for the aid emblazoned with the group’s logo and the title “Islamic State, Raqqa Province, Alms Administration.” The photos correspond with Associated Press reporting from activists in the area.