Watch: The insurgent Arakan Army video of their capture of the barracks
The end, when it came for the BGP5 barracks, was loud and brutal. First, a crackly speaker calling out for their surrender; then, a thunderous barrage of artillery, rockets and rifle fire that tore chunks out of the buildings in which hundreds of soldiers were hiding.
BGP5 – the letters stand for Border Guard Police – was the Myanmar military junta's last stand in northern Rakhine State, which lies along the border with Bangladesh.
Video by the insurgent Arakan Army (AA) which was besieging the base shows their rag-tag fighters, many barefoot, firing an assortment of weapons into the base, while air force jets roar over their heads.
It was a ferocious battle - perhaps the bloodiest of the civil war which has consumed Myanmar since the military seized power in a coup in 2021.
"They had dug deep ditches filled with spikes around the base," an AA source told the BBC.
"There were bunkers and reinforced buildings. They laid more than a thousand mines. Many of our fighters lost limbs, or their lives, trying to get through."
For the coup leader, General Min Aung Hlaing, this has been yet another humiliating defeat after a year of military setbacks.
For the first time his regime has lost control of an entire border: the 270km (170 miles) dividing Myanmar from Bangladesh now wholly under AA control.
And with only the Rakhine State capital Sittwe still firmly in military hands, though cut off from the rest of the country, the AA is likely to be the first insurgent group to take complete control of a state.
The army has been in headlong retreat from the Arakan Army since the beginning of the year, losing town after town.
The last army units withdrew in September to BGP5, a compound covering around 20 hectares just outside the border town of Maungdaw, where the AA laid siege.
BGP5 was built on the site of a Muslim Rohingya village, Myo Thu Gyi, which was burned down during the violent expulsion of much of the Rohingya population by the armed forces in 2017.
It was the first of many burned villages I saw on a visit to Maungdaw right after the military operation in September of that year, a mass of charred debris in among the lush tropical vegetation, its inhabitants killed or forced to flee to Bangladesh.
When I returned two years later, the new police complex had already been built, with all the trees removed, giving defenders a clear view of any attacking force.
The AA source told us their advance towards it was painfully slow, requiring the insurgents to dig their own ditches for cover.
It does not publish its own casualties. But judging from the intensity of fighting in Maungdaw, which began in June, it is likely to have lost hundreds of its own troops.
Throughout the siege, the Myanmar air force kept up a constant bombardment of Maungdaw, driving the last civilians out of the town.
Its planes dropped supplies to the besieged soldiers at night, but it was never enough. They had plenty of rice stored in the bunkers, a local source told us, but they could not get any treatment for their injuries, and the soldiers became demoralised.
They started to surrender last weekend.
AA video shows them coming out in a pitiful state, waving white cloths. Some are hobbling on makeshift crutches, or hopping, their injured legs wrapped in rags. Few are wearing shoes.
Inside the wrecked buildings the victorious insurgents filmed piles of bodies.
The AA says more than 450 soldiers died in the siege. It has published images of the captured commander, Brigadier-General Thurein Tun, and his officers kneeling beneath the flagpole, now flying the insurgents' banner.
Pro-military commentators in Myanmar have been venting their frustration on social media.
"Min Aung Hlaing, you have not asked any of your children to serve in the military," wrote one. "Is this how you use us? Are you happy seeing all those deaths in Rakhine?"
"At this rate, all that will be left of the Tatmadaw [military] will be Min Aung Hlaing and a flagpole," wrote another.
The capture of BGP5 also shows the Arakan Army to be one of the most effective fighting forces in Myanmar.
Formed only in 2009 – much later than most of Myanmar's other insurgent groups – by young ethnic Rakhine men who had migrated to the Chinese border on the other side of the country in search of work, the AA is part of the Three Brotherhood Alliance which has inflicted most of the defeats suffered by the junta since last year.
The other two members of the alliance have stayed on the border, in Shan State.
But the AA moved back to Rakhine eight years ago to start its armed campaign for self-government, tapping into historic resentment among the Rakhine population of the poverty, isolation and central government neglect of their state.
The AA leaders have proven to be smart, disciplined and able to motivate their fighters.
They are already administering the large areas of Rakhine State they control as though they were running their own state.
And they also have good weapons, thanks to their links with the older insurgent groups on the Chinese border, and appear to be well-funded.
There is a bigger question, though, over how much the various ethnic insurgent groups are willing to prioritise the goal of overthrowing the military junta.
Publicly they say they do, alongside the shadow government which was deposed by the coup, and the hundreds of volunteer peoples' defence forces which have sprung up to support it.
In return for the support it is getting from the ethnic insurgents, the shadow government is promising a new federal political system which will give Myanmar's regions self-rule.
But already the other two members of the Three Brotherhood Alliance have accepted China's request for a ceasefire.
China is seeking a negotiated end to the civil war which would almost certainly leave the military with much of its power intact.
The opposition insists the military must be reformed and removed from politics. But having already made so many territorial gains at the expense of the junta, the ethnic insurgents may be tempted to strike a deal with China's blessing rather than keep fighting to oust the generals.
The AA's victory poses more worrying questions.
The group's leadership is tight-lipped about its plans. But it takes over a state that was always poor and which has suffered greatly from the intense fighting of the past year.
"Eighty per cent of the housing in Maungdaw and the surrounding villages has been destroyed," one Rohingya man who left Maungdaw recently for Bangladesh told the BBC.
"The town is deserted. Almost all the shops and houses have been looted."
Last month the United Nations, whose agencies are being given very little access to Rakhine, warned of looming famine, because of the huge numbers of displaced people and the difficulty of getting any supplies in, past a military blockade.
The AA is trying to set up its own administration, but the BBC has been told by some of those displaced by the fighting that the group cannot feed or shelter them.
It is also unclear how the AA will treat the Rohingya population, still thought to number around 600,000 in Rakhine, even after the expulsion of 700,000 in 2017.
The largest number live in northern Rakhine State and Maungdaw has long been a predominantly Rohingya town. Relations with the ethnic Rakhine majority, the support base for the AA, have long been fraught.
They are now a great deal worse after Rohingya militant groups, which have their power base in the vast refugee camps in Bangladesh, chose to take sides with the military, against the AA, despite the army's track record of persecuting Rohingyas.
Many Rohingyas do not like these groups, and some say they are happy to live in an AA-run Rakhine State.
But tens of thousands have been expelled by the AA from towns it has conquered, and not been allowed back.
The AA has promised to include all communities in its vision for a future independent of the central government, but it has also denounced the Rohingyas it found itself fighting alongside the army.
"We cannot deny the fact that Rohingyas have been persecuted by Myanmar governments for many years, and the Rakhine people supported that," said the Rohingya man we spoke to in Bangladesh.
"The government wants to keep Rohingyas from becoming citizens, but the Rakhine people believe there should be no Rohingyas at all in Rakhine State. Our situation today is even more difficult than it was under the rule of the military junta."