HARARE, Zimbabwe — In the densely forested, oil-and-gas-rich northeast corner of Mozambique, a local Islamic insurgency has steadily escalated with a growing allegiance to the Islamic State and the arrival of foreign fighters using operational techniques similar to those from conflicts in Syria, Afghanistan and Iraq.

Insurgents decapitated as many as 50 people in attacks on several villages earlier this month in Cabo Delgado province, according to Police Commander Bernardino Rafael.

The attacks in the mainly Christian area of Muidumbe were condemned by the United Nations, which this week called for an investigation into the reports that militants had massacred villagers and beheaded women and children.

The beheadings reflected the continuing expansion of the insurgency that began in earnest in October 2017 along the northern coastal area of Cabo Delgado but has moved to the interior into the heartland of the Makonde tribe of Mozambican President Filipe Nyusi.

Nyusi and Mozambican Defense Minister Jaime Neto have accused the insurgents of being armed from outside the country.

“In this terror threat, we have signs of involvement of foreigners who are recruiting and training local youth, and also equipping them, because we don’t know how they get their equipment,” Nyusi said on Aug 10.

The United States is also seeing the hallmarks of the Islamic State on the conflict. In August, Maj. Gen. Dagvin R.M. Anderson, commander of U.S. Special Operations Command Africa, said in a briefing to the State Department that the core Islamic State provides fighters in Mozambique “training, it provides them education, and it provides them additional resources.”

The group, known by locals as al-Shabab, but with no affiliation to the Somali group of the same name, carried out its first major incursion into southern Tanzania last month, raising alarm in a region where four countries — Tanzania, Malawi, Zimbabwe and Zambia — intersect with Mozambique.

The Islamic State formally adopted al-Shabab as the Mozambican wing of its Central Africa Province in June last year. Images released by the Islamic State on behalf of its Central African Province branch, known as IS-CAP, this year show fighters in Cabo Delgado armed with AK-47s, machine guns and rocket propelled grenades.

U.S. counterterrorism officials expressed alarm this week over the group’s swelling ranks and military prowess. What once was regarded as a locally rooted insurgency now shows a clear intention of aligning itself — ideologically and tactically — with the Islamic State’s main branch.

“It is a significant threat from a terrorism point of view, whatever its origins,” said Nathan Sales, appointed earlier this week as the U.S. special envoy to the global coalition against the Islamic State. “It is now a committed ISIS enterprise that is using violence to gain — and in some cases maintain control over — territory.”

The mass beheading of men and boys in northern Mozambique was “not the sort of thing you associate with a low-grade insurgency,” Sales said, “but it’s the sort of behavior we saw from ISIS at the height of its so-called caliphate.”

Last week, insurgents captured the district capital of Muidumbe in Cabo Delgado and by Wednesday were pushing toward the strategically important town of Mueda, where the national government runs its military operations for the province, several security analysts said.

A spokesman for the Mozambique Defense Force, Col. Omar Saranga, did not respond to requests for comment on the surge of militant activity.

“The loss of Mueda would have a major impact on the government’s ability to operate in northern Cabo Delgado,” said Johann Smith, an independent security analyst based in the capital, Maputo, where he advises companies on the security situation in Mozambique. He estimated the insurgents number somewhere between 3,000 to 3,500 fighters.

“If they take Mueda, there is no way to reach the north by vehicle, and all access routes could be controlled by the insurgents” including those to Palma, where oil companies operate from, Smith said.

In their biggest success so far — and one that marked an about-turn in the militants’ capabilities — the insurgents captured the town and port of Mocimboa da Praia in early August, close to where major international oil companies, seeking to tap massive offshore gas fields, are so far unaffected by the conflict. French company Total has operations about 37 miles from Mocimboa da Praia at the coastal town of Palma.

“Every day that passes is lost to the disaster, a bloody deepening disaster,” said Martin Ewin, regional coordinator for Southern Africa at the Institute for Security Studies in Pretoria, South Africa.

Gerald Bourke, spokesman for the U.N.’s World Food Program in southern Africa, said the deepening crisis had displaced close to 400,000 people, with the majority of people arriving this year as the conflict escalated.

“The situation is grim,” Bourke said. “WFP has been supporting as many as possible but access is not easy, both from a security point of view and also because a lot of people have been on the move.”

Alain Kassa, head of the Mozambique mission for aid agency Doctors Without Borders, said thousands of villagers had arrived in the regional capital Pemba, which remained firmly in government hands, from Mocimboa. In the last two weeks about 15 boats a day had arrived in Pemba, each carrying between 40 to 70 people in a journey that usually lasted between five to 10 days, Kassa said.

Others traveled on foot or by minibus, while an unknown number were still hiding in the bush until it was safe to travel, he said. The onset of the rainy season put many of them at risk of malaria, he said.

A possible increase in support for Mozambique was among the topics discussed at a meeting of coalition members this week. U.S. officials said they were seeking to partner with South Africa, Tanzania and other regional states to try to help Mozambique battle the group and prevent the militants from gaining a larger foothold in the east.

Martin of the Institute for Security Studies said the insurgency would not have grown to the “frightening and hard-to-contain levels” if there had been a quick and robust regional response.

“There was a serious misreading of the situation, a miscalculation that this was a small domestic problem, well within Mozambique’s capacity to snuff out,” he said.

While the Mozambican military has largely fought the insurgents on its own, with assistance from private military contractors from Zimbabwe and South Africa, their response was poorly resourced and funded, according to the Institute for Security Studies.

“This is now a race against time because the longer it takes to organize a robust and effective regional response against these insurgents, the more difficult it is going to get,” Martin said.

In May, a meeting of the Southern African Development Community, or SADC, a regional block comprising 15 southern African states, noted the insurgency as worrying but left it mostly to Mozambique to deal with.

A senior Zimbabwean government official said there are feverish behind-the-scenes discussions now going on among SADC members on the Mozambican crisis.

“I wouldn’t say there is panic, but you can definitely feel there is a huge sense of urgency because of the latest developments,” said the official, speaking on the condition of anonymity because he was not authorized to make comments to the media.

The conflict adds another Islamist flash point in sub-Saharan Africa, where insurgencies are ongoing in Nigeria, Mali, Niger and Burkina Faso.

Eric Morier-Genoud, a Mozambique expert from Queens University in Belfast, said al-Shabab first emerged more than a decade ago, building their own mosques and applying Sharia, Islamic religious law, within their own community, while pursuing a doctrine that rejected the state.

At the start of the conflict, fighters had no shoes, shared guns and carried machetes. “That went on for one or two years,” he said. “They are now well established, more organized and have good logistics.”

Wroughton reported from Cape Town, South Africa; Warrick reported from Washington.