The United Nations said both of those bases were attacked early Saturday by “armed elements.” Reinforcements reached the first base, and all of the 32 Philippine soldiers there were able to escape to safety.

The second base took fire from mortars and machine guns, the United Nations said. The peacekeepers inside returned fire and kept the attackers from entering, but fighting kept the peacekeepers stuck in the area. Gen. Gregorio Pio Catapang, the Philippine military chief, said Sunday that the remaining 40 peacekeepers had moved to positions that were safely away from any further threat, The Associated Press reported. “We may call it the greatest escape,” he said.

The United Nations also withdrew its personnel from an observation post because of the firing nearby. No personnel were hurt.

Lt. Libby Weiss, a spokeswoman for the Israeli military, said that the United Nations peacekeeping force had evacuated two of its outposts in Syria on Saturday and relocated the troops to a post on the Israeli side of the demarcation line. She provided no other information.

The United Nations did not say who had fired on its forces.

A number of rebel groups have participated in the battle against the forces of President Bashar al-Assad of Syria in the area. Though none have claimed responsibility for capturing the peacekeepers from Fiji, other rebels have blamed the Nusra Front, Syria’s Qaeda affiliate.