Thousands of prisoners were crammed into a squalid prison to the east of Kabul last month until the Taliban set them free as the militants closed in on the capital.
It was a strategy the hardline Islamists used across the country during their lightning offensive – target prisons in order to liberate Islamist inmates and boost their fighting ranks.
But in doing so, the Taliban also released tens of thousands of criminals back into society, among them murderers, rapists and thieves.
A tour of the notorious, now largely deserted Pul-e-Charkhi jail provides a fascinating glimpse into life behind bars for its 15,000 former inmates.
The cells of one wing are littered with clothes, shoes and other possessions of prisoners who slipped away when the Taliban opened the gates on August 14, just one day before it seized the capital.
The prison officers also fled – in many cases leaving their uniforms behind.
Now, the facility, the country’s largest, is littered with rubbish, and the stench of rotting food and fetid latrines hangs heavy over the site.
Taliban gunmen who now control the prison say the 11 blocks in the main wing each used to house 1,500 inmates – mostly common criminals, petty thieves and hardcore gangsters.
It remains to be seen if it will ever be as full again.
The Taliban has promised a milder form of rule this time, but in its first incarnation from 1996 to 2001, it practised summary justice, with punishment including executions for murderers and rapists, limb amputations for thieves, and stoning for adulterers.
Taliban prisoners were also among those detained at the Pul-e-Charkhi – as well as even more hardcore militants from the Islamic State in Iraq and Syria (ISIS) group.
One cell visited by AFP bears the ISIS slogan painted in black on the wall, while the words “Islamic State” are etched into the plaster of a stairwell.
Construction of Afghanistan’s largest prison began in the 1970s and in the decades since, it has been criticised by human rights groups for its squalid and cramped conditions.
While wealthy inmates could bribe guards for private cells and toilets, most had to live on diets that barely met basic nutritional standards.
They faced freezing conditions in winter and sweltering heat in summer. Visitors were allowed at the authorities’ whim, while those who would not toe the line were subjected to floggings.
Riots, uprisings and breakouts were commonplace in Afghan prisons, frequently put down under a hail of bullets.
Some dormitories housed 15 to 20 prisoners in bunks, with shawls serving as curtains between each bed frame providing the only privacy.
Other cells held just three inmates, two on mattresses side by side on the floor and one perched precariously on a makeshift shelf.
Few had the luxury of a toilet.
Still, there were some homely touches.
Wallpaper depicting tropical sunsets adorn the concrete walls of several units, others are covered in the tricolour flag of the previous government, and a few inmates even kept birds – imprisoned as they were – in cages.
A prayer room with dozens of mats neatly arranged in a row is noticeably the tidiest area of the block, while another section had been turned into a makeshift madrasah, or school for Islamic instruction.
Near the entrance to one block, the administrative office has been completely burned out – the last act of prisoner defiance before fleeing.
The caps, grey shirts, trousers, boots and helmets of former guards hang abandoned from when they left their posts when it became clear the Taliban would take Kabul.
Outside, cats and dogs roam the perimeter road around the vast circular complex, lined by a 4m-high wall topped by razor wire and punctuated by watchtowers.
A visiting area is riddled with bullet holes, where a last stand took place before the guards took flight.
Mr Mawlawi Abdulhaq Madani, a 33-year-old Taliban fighter now guarding the prison, is happy to see it empty.
It was, he said, “a place of horror”.