CAIRO — Fighters aligned with Libya’s United Nations-backed unity government are advancing along the Mediterranean coast toward the Islamic State stronghold of Surt, signaling the first major assault on territory that, since last year, has become the terrorist group’s largest base outside Iraq and Syria.

Two separate militia forces have fought their way toward the city in recent days, attacking from both the east and the west, in apparently uncoordinated attacks that have reduced the length of Libyan coastline controlled by the Islamic State to 100 miles from about 150 miles. On Wednesday, one of the militias claimed to have seized control of Surt’s power plant, 20 miles west of the city.

Those victories occurred in sparsely populated areas, and it was unclear whether the militias had either the strength or the will to push into Surt, which is thought to be heavily fortified and also harbor several thousand foreign fighters. But the advance did signal a new setback for the Islamic State, also known as ISIS or ISIL, at a time when it is already under concerted attack in Falluja, Iraq, and in parts of Syria.

Analysts and diplomats warn that while the offensive addresses the West’s biggest concern in Libya, it also risks destabilizing the fragile peace effort there by fostering violent competition between rival groups.