How a Libyan city joined Islamic State Ruthless: An image from an Islamic State propaganda video. Cairo: On a chilly night, bearded militants gathered at a stage strung with colourful lights in Derna, a Mediterranean coastal city long notorious as Libya's centre for jihadist radicals. With a roaring chant, they pledged their allegiance to the leader of the Islamic State group. With that meeting 10 days ago, the militants dragged Derna into becoming the first city outside Iraq and Syria to join the "caliphate" announced by the extremist group. Already, the city has seen religious courts ordering killings in public, floggings of residents accused of violating sharia, as well as enforced segregation of male and female students. Opponents of the militants have gone into hiding or fled, terrorised by a string of slayings aimed at silencing them. The takeover of the city, some 1600 kilometres from the nearest territory controlled by the Islamic State group, offers a revealing look into how the radical group is able to exploit local conditions. A new Islamic State commander now leads the city, identified as Mohammed Abdullah, a little-known Yemeni militant sent from Syria and known as Abu al-Baraa al-Azdi, according to several local activists and a former militant from Derna. A number of leading Islamic State militants came to the city from Iraq and Syria this year and over a few months united most of Derna's multiple but long-divided extremist factions behind them. They paved the way by killing any rivals, including militants, according to local activists, former city council members and a former militant interviewed by The Associated Press. They all spoke on condition of anonymity out of fear for their lives. Derna could be a model for the group to try to expand elsewhere. Notably, in Lebanon, army troops recently captured a number of militants believed to be planning to seize several villages in the north and proclaim them part of the "caliphate." Around the region, a few militant groups have pledged allegiance to its leader, Iraqi militant Abu Bakr al-Baghdadi. But none hold cohesive territory like those in Derna do. The vow of allegiance in Derna gives the Islamic State group a foothold in Libya, an oil-rich North African nation whose central government control has collapsed in the chaos since the 2011 overthrow and death of long-time dictator Muammar Gaddafi. Extremists made Derna their stronghold in the 1980s and 1990s during an insurgency against Gaddafi, the city protected by the rugged terrain of the surrounding Green Mountain range in eastern Libya. Derna was the main source of Libyan jihadists and suicide bombers for the insurgency in Iraq after the US-led invasion. Entire brigades of Derna natives fight in Syria's civil war. This spring, a number of Libyan jihadists with the Islamic State group returned home to Derna. The returnees, known as the Battar Group, formed a new faction called the Shura Council for the Youth of Islam, which began rallying other local militants behind joining the Islamic State group. In September, Abu al-Baraa al-Azdi arrived. Many of Derna's militants joined, though some didn't. Part of Ansar al-Sharia, one of the country's most powerful Islamic factions, joined while another part rejected it. The main militant group that refused was the Martyrs of Abu Salem Brigade, once the strongest force in Derna. The group sees itself as a nationalist Libyan force and calls for a democratically formed government, albeit one that must enforce stricter Islamic law. For the past months, it has battled the al-Battar fighters and the Shura Council. Al-Battar accused the Abu Salem militia of killing one of its top commanders in June and threatened in a statement to "fill the land with [their] graves." Meanwhile, a militant campaign of killings targeted the liberal activists who once led sit-ins against them, as well as lawyers and judges. Militants also stormed polling stations, stopping voting in Derna during nationwide elections in March and June. In July, a former liberal MP, Farieha al-Berkawi, was gunned down in broad daylight. Her killing in particular chilled the anti-militant movement, said a close friend. "People had done their best [to force out militants] and got nothing but more bloodshed," she said. Those who stayed tried to coexist. Some submitted letters of "repentance" to the Islamist militias, denouncing their past work in the government. Militant group Facebook pages are dotted with letters of repentance submitted by a traffic police officer, a former militiaman and a former colonel in the Gaddafi security apparatus. With opposition silenced, militant factions first came together on October 5 and decided to pledge allegiance to al-Baghdadi and form the Islamic State group's "Barqa province," using a traditional name for eastern Libya. After the gathering, more than 60 pick-up trucks filled with fighters cruised through the city in a victory parade. Last week, a second gathering in front of a social club saw a larger array of factions make a more formal pledge of allegiance. Abu al-Baraa al-Azdi attended the event, according to the former militant. The militant himself did not attend but several of his close relatives who belong to Ansar al-Sharia did. Now, government buildings in Derna are "Islamic State" offices, according to the activists. Cars carrying the logo of the "Islamic police" roam the city. Women increasingly wear full face veils. Masked men have flogged young men caught drinking alcohol, a former city council member said. Militants have ordered that male and female students must be segregated at school, and history and geography were removed from the curriculum, according to two activists in the city. New "Islamic police" flyers order clothing stores to cover their mannequins and not display "scandalous women's clothes that cause sedition." Opposition to the militants, already scattered, is under threat. During the extremists' first meeting, a colleague recounted how Osama al-Mansouri, a lecturer at Derna's Fine Arts college, stood up and asked the bearded men: "What do you want? What are you after? Two days later, gunmen shot Mr Mansouri dead in his car.