YOLA, Nigeria—The battle began with two small drones buzzing over a base where more than 500 Nigerian troops guarded the shores of Lake Chad. Then came the clatter of gunfire from a column of armored cars, artillery units and tanks that also blasted jihadist battle songs from mounted speakers.

Within hours, elite forces from one of Africa’s most powerful militaries had abandoned their base and its cache of heavy weapons, routed by an insurgent army fighting under the familiar black and white flag of Islamic State.

“We were sitting ducks,” said Bitrus Madu, a Nigerian sergeant who fled the base in the town of Baga in December and walked through forests for three days to reach safety. “The terrorists control the whole region now.”

In recent months, as Islamic State has seen its self-described caliphate in Iraq and Syria radically shrink, a Nigeria-born group calling itself the Islamic State West Africa Province, or ISWAP, has taken control of hundreds of square miles of territory, according to Nigerian and Western officials.

The group’s rapid rise, largely away from public view, foreshadows the next chapter for Islamic State. Its local allies are expanding in a flurry of far-flung states, battling local armies and carving fundamentalist enclaves in Afghanistan, Mali, the Philippines and Somalia. Islamic State’s threat to regional governments and the West is likely to continue, U.S. intelligence chiefs said in a formal risk assessment last week.