DAMASCUS, Syria — Syrian government forces, aided by Russian airstrikes and Iranian-backed militias, have ousted Islamic State militants from their last foothold in a major city, the army said on Friday, taking another chunk from the group’s waning territory, which once spanned large parts of Syria and Iraq.

The pro-government alliance has driven the militants from the last few neighborhoods controlled by the group in the city, Deir al-Zour, an eastern provincial capital, the Syrian military said in a statement.

The Islamic State, also known as ISIS or ISIL, had at one point surrounded the government-held section of the city, besieging 200,000 civilians. The United Nations was occasionally able to deliver food aid by airplane.

As Syrian government forces retook Deir al-Zour, their Iraqi counterparts seized control of a crucial border crossing nearby after taking over most of the town of Qaim. The advance gave the Iraqis and their American-led coalition allies a forward operating position to monitor any remaining Islamic State fighters fleeing the converging armies.

The Iraqi chief of staff said that only a few pockets of resistance remained in Qaim on the eighth day of the military operation against the Islamic State’s last remaining territory in Iraq.

The Syrian government’s announcement of victory in Deir al-Zour came just weeks after an American-backed, Kurdish-led militia force took over the city of Raqqa, about 90 miles away. Unlike in Raqqa, which had served as the de facto capital of the Islamic State, the militants were never able to control the whole of Deir al-Zour, although the group held most of the surrounding province, an oil-rich region that provided an important source of revenue to the militants.

The Islamic State has lost a vast majority of its self-declared caliphate, which at its height controlled large portions of Syria and Iraq. It still holds the border town of Bukamal, Syria, a strategic point on the highway from Damascus, the Syrian capital, to Baghdad.

All the players in the multilayered war covet influence in the Deir al-Zour area, and several forces are converging there: the alliance that supports the Syrian government; the rival American-backed group known as the Syrian Democratic Forces; and Iraqi forces that are pursuing Islamic State holdouts on their side of the border.

The stakes are high in this new phase of the battle. The fighting in the area could escalate as the Syrian Democratic Forces, backed by American warplanes, and the pro-government alliance, which has Russian air support, both advance against the Islamic State’s remaining pockets in the province of Deir al-Zour.

Russia, which wants to see the Syrian government take back all of its territory, and the United States, which wants to counter Iranian influence, have accused each other of firing at their respective allies on the ground.

Iran wants friendly forces to control the area to establish a land route linking Iran and Lebanon, the base of its most powerful allied militia in the region, Hezbollah.

And the Syrian Defense Forces, a Kurdish and Arab alliance, wants to seize as much territory as possible, including oil fields, to increase its chances of staving off a government takeover of the areas it holds, including Raqqa and the areas to the northeast where Kurds have carved out a measure of autonomy.

Adding to the complications, the Iraqis are allied with both of the rival coalitions in Syria. Iraqi forces are aided by Iranian-backed militias and by American forces.

“We fled from the intensive bombings because we could not stay there any more,” said Alia Mohamed, 33, at a park in Damascus where she watched her 4-year old daughter — one of her six children — run around as her husband tried to find a room for the family.

At a school shelter in Qudsaya, a suburb northwest of Damascus, Hosna Quray’a, who said that she had been displaced for two years, greeted the news with “great joy.”

“I want to return back,” she said. “Most of my relatives left there, and I don’t know what happened to them.”

Ibrahim Haj Hussein, a 14-year-old from the government-controlled part of Deir al-Zour, traveled to the shelter eight months ago because his mother was sick. He left his father behind. “The situation there was really tough,” he said, adding that the price of food was so high that his family had subsisted on a diet of bulgur wheat and rice.