IS loses Deir al-Zour in Syria and al-Qaim in Iraq on same day
So-called Islamic State (IS) has lost control of two of its last remaining strongholds in Syria and Iraq.
Early on Friday Syria's army announced it had taken Deir al-Zour. Later in the day the Iraqi prime minister said al-Qaim, across the border, had been recaptured by government forces.
The town was taken "in record time", PM Haider al-Abadi said.
Iraqi forces say they have also seized the last border post between Iraq and Syria that was held by IS.
Last month, a US-backed Syrian alliance took control of Raqqa in Syria, the former capital of Islamic State's self-styled "caliphate".
In July, Mosul - Iraq's second-largest city - was taken from IS after months of fighting.
The territorial ambitions of IS are now all but destroyed although its ideology remains powerful, says the BBC's Arab Affairs Editor Sebastian Usher.
Why are these losses important?
IS had held most of Deir al-Zour since 2014. It was important because of its proximity to the border with Iraq.
While the Syrian army said it had been re-captured, other reports said government forces and their allies were clearing the last pockets of resistance from IS in the city.
Al-Qaim was the last sizeable territory held by IS in Iraq. The operation to retake the city and the surrounding area was launched last week.
Soldiers, police, Sunni tribesmen and mostly Shia paramilitary fighters, some backed by Iran, took part in the assault.
IS had designated the area on both sides of the border as its "Euphrates Province" and used it to transfer fighters, weapons and goods between Iraq and Syria.
The cross-border province was also a symbol of the jihadists' intention to eradicate all the region's frontiers and lay to rest the 1916 Sykes-Picot agreement, an emblem of the colonial division of the area resented by many Arabs.
Some 350,000 civilians in Syria's Deir al-Zour province have been forced to flee their homes during weeks of fighting.
What territory does IS still control?
In Syria, the militant group is now confined to a few pockets in Deir al-Zour province.
The Syrian Democratic Forces (SDF) and Syrian government forces have been carrying out separate offensives there with the aim of taking control of Albu Kamal, a key crossing with Iraq.
Interactive Slide the button to see how the area IS controls has changed since 2015
In some areas the US-backed SDF and Russia-backed Syrian army have taken up positions just a few kilometres apart.
An SDF spokesman told the BBC they were still encountering some resistance with the militants using suicide cars and trucks, thermal missiles and mortars. In some towns and villages there was house-to-house fighting, Kino Gabriel said.
IS has also suffered a series of defeats in recent months to Iraqi government forces, who are advancing along the Euphrates river on the other side of the border.
There are about 1,500 IS fighters left in the area, the US-led coalition fighting IS says.
Is this the end for IS?
IS has now been driven out of about 95% of the land the group once held in Iraq and more than 4.4 million Iraqis have been freed from its rule, according to the US-led coalition.
The group has just "months [remaining] at most as a proto-state", the senior Royal Air Force (RAF) officer overseeing British airstrikes against IS in Iraq and Syria said on Friday.
But Commodore Johnny Stringer told journalists in London that IS would "almost certainly morph into an insurgent organisation" trying to launch attacks in the two countries.
What now in Syria?
Jonathan Marcus, BBC diplomatic correspondent
The success of the Syrian government forces inevitably raises the potential for clashes between them and US-backed, predominantly Kurdish units who hold a swathe of northern Syria.
It is a powerful reminder that while the war against the IS "caliphate" is well on the way to being won, the situation on the ground in Syria is becoming ever more complex.
With Iran eager to consolidate its influence, questions remain as to the Trump administration's future policy direction now IS is collapsing. Syrian President Bashar al-Assad has consolidated his position and looks to squeeze opposition forces in the months ahead.