BEIRUT/ERBIL - Islamic State's self-proclaimed caliphate was all but reduced on Friday to a pair of border towns at the Iraq-Syria frontier, where thousands of fighters were believed to be holding out after losing nearly all other territory in both countries.Forces in Syria and Iraq backed by regional states and global powers now appear on the cusp of victory over the group, which proclaimed its authority over all Muslims in 2014 when it held about a third of both countries and ruled over millions.On the Syrian side, government forces declared victory in Deir al-Zor, the last major city in the country's eastern desert where the militants still had a presence. On the Iraqi side, pro-government forces said they had captured the last border post with Syria in the Euphrates valley and entered the nearby town of al-Qaim, the group's last Iraqi bastion.A US-led international coalition which has been bombing Islamic State and supporting ground allies on both sides of the frontier said the militant group now has a few thousand fighters left, mainly holed up at the border in Iraq's al-Qaim and its sister town of Albu Kamal on the Syrian side."We do expect them now to try to flee, but we are cognizant of that and will do all we can to annihilate IS leaders," spokesman US Colonel Ryan Dillon said.He estimated there were 1,500-2,500 fighters left in al-Qaim and 2,000-3,000 in Albu Kamal.But both the Iraqi and Syrian governments and their international backers say they worry that the fighters will still be able to mount guerrilla attacks once they no longer have territory to defend."As IS continues to be hunted into these smallest areas ... we see them fleeing into the desert and hiding there in an attempt to devolve back into an insurgent terrorist group," said Dillon. "The idea of IS and the virtual caliphate, that will not be defeated in the near term. There is still going to be an IS threat."Driven this year from its two de facto capitals -- Iraq's Mosul and Syria's Raqqa -- Islamic State is pressed into an ever-shrinking pocket of desert straddling the frontier.In Iraq, it faces the army and Shi'ite armed groups, backed both by the US-led international coalition and by Iran. In Syria, the coalition supports an alliance of Kurdish and Arab militias in areas north and east of the Euphrates, while Iran and Russia support the government of President Bashar al-Assad.On the Syrian side, the government victory at Deir al-Zor, on the west bank of the Euphrates, ends a two month battle for control over the city, the center of Syria's oil production. Islamic State had for years besieged a government enclave there until an army advance relieved it in early September, starting a battle for jihadist-held parts of the city."The armed forces, in cooperation with allied forces, liberated the city of Deir al-Zor completely from the clutches of the Daesh terrorist organization," state media reported, using an Arabic acronym for Islamic State.Engineering units were searching streets and buildings in Deir al-Zor for mines and booby traps left behind by Islamic State fighters, a Syrian military source told Reuters.Government forces are still about 40km from the border at Albu Kamal, where they are preparing for a final showdown."The defeat of Albu Kamal practically means Daesh will be an organization that will cease to exist as a leadership structure," the military source said. "It will be tantamount to a group of scattered individuals, it will no longer be an organization with headquarters, with leadership places, with areas it controls."BESIEGED FROM ALL DIRECTIONSThe source added that he did not believe the final battle at Albu Kamal would involve "fierce resistance", as many fighters had been surrendering elsewhere."Some of them will fight until death, but they will not be able to do anything," he said. "It is besieged from all directions, there are no supplies, a collapse in morale, and therefore all the organization's elements of strength are finished."In Iraq, the military's Joint Operations Command said on Friday the army, along with Sunni tribal fighters and Iran-backed Shi'ite paramilitaries known as Popular Mobilization, had captured the main border crossing on the highway between al-Qaim and Albu Kamal.They had also entered the town of al-Qaim itself, which is located just inside the border on the south side of the Euphrates. The offensive is aimed at capturing al Qaim and another smaller town further down the Euphrates on the north bank, Rawa.Iraq has been carrying out its final campaign to crush the Islamic State caliphate while also mounting a military offensive in the north against Kurds who held an independence referendum in September.