WASHINGTON — On June 13, as militants loyal to the Islamic State were tying down Philippine soldiers in the southern city of Marawi for a fourth week, U.S. Secretary of Defense James Mattis testified before a U.S. Senate committee that the decision to scale back the United States counterterrorism mission in the Philippines in 2014 had been “premature.”

At the time the mission, known as the Joint Special Operations Task Force Philippines, looked like a success. With just a small footprint — never more than 600 people — it had spent well over a decade providing intelligence and training to Philippine forces, while working closely with the United States Agency for International Development to improve infrastructure, public health and livelihoods.

But the decision to radically shrink the mission coincided with both the resurgence of Abu Sayyaf — a small group of Muslim militants best known for its campaign of kidnappings, which rebranded itself then by declaring allegiance to the Islamic State — and the spread, in the Philippines and elsewhere in Southeast Asia, of new radical Islamist groups. Today, at least six groups in the southern Philippines have pledged allegiance to the Islamic State, and they attract new recruits and foreign fighters.

With its best forces pinned down in Marawi, were another Islamist group, or a communist one, to start an offensive elsewhere, the army would be spread very thin. Some troops have been seen entering zones of fighting using tree trunks to shield their vehicles.