The Taliban's brazen assault on the strategic city of Ghazni, south of the capital Kabul, has come as a major blow to the Afghan government and its international allies. At least 140 members of the security forces and 60 civilians died in five days of fighting, along with possibly hundreds of Taliban fighters, before the militants were pushed back.
BBC Pashto journalist Assadullah Jalalzai spent three days under siege before managing to escape the city, which now appears to be back in government control. Here is his account of what happened.
Friday, 10 August - 'They came dressed as soldiers'
The silence in the city was suddenly broken with rapid heavy gunfire at around 00:30. It woke everyone up. My little ones started crying. The first thing I did was to move everyone away from the windows. Moments later I heard my elderly neighbour calling out loudly and warning: "Do not step out of your houses."
My neighbour to the side started knocking on the wall to just make sure we were alert and okay. No one slept for the rest of the night, not even the little ones.
In the morning, residents could see black smoke rising from many parts of the city. All of the telecommunications towers are located on a single hill and all were on fire. There was a complete communications shutdown.
To add to our misery, the water system in the city broke down too. This meant that more than 5,000 families were left without drinking water.
At the base of the hill I saw an overturned military humvee. There were five bodies still trapped inside - all Afghan army soldiers. There were also dead bodies in other parts of the city. Their army uniforms made you think they were soldiers. But when you looked closer and saw their long beards and hair, you realised they were actually Taliban fighters who had used soldiers' uniforms to infiltrate the city.
The sun started to go down behind the mountains to the west of the city. Residents were still trapped inside their houses as fighting raged in the streets outside. Many of them were unaware of exactly what was happening elsewhere.
The truth was Taliban fighters had attacked Ghazni from all four directions and heavy clashes had continued throughout the city for most of the first day. We spent the night listening to light gunfire and helicopters circling the skies.
No-one knew what was happening to their next-door neighbours. It was simply too dangerous to step out of your front door.
Saturday, 11 August - 'Running out of medicine'
Taliban fighters were now inside the city, right in the centre of it. They set fire to a police training centre in Cinema Square. Another group of fighters stood on Broken Bridge, holding their machine guns and rocket launchers.
Not far away there were Afghan army soldiers behind the Green Mosque. The distance between the two sides was not more than 100m. Gunfire erupted as soon as a soldier or a Taliban fighter stepped out from behind a wall.
And in the middle of all this there were residents trying to flee, crouching as they moved to avoid a bullet to the head. In a desperate situation, more bad news arrived. The electricity supply to the city had been shut down.
The local hospital was overcrowded with hundreds of injured people. I saw dozens of dead bodies lying on top of each other and people desperately searching for relatives among the dead and wounded. You would hear a loud cry and you would know they had identified one of the dead.
Then an ambulance arrived with more injured people. The driver told us they were Taliban fighters.
The head of the clinic turned to him and said: "Take them to another clinic. We have injured police officers inside. The last thing I want is for them to start firing at each other inside the hospital."
The injured were lying on the hospital lawn. Six doctors were trying to attend to them. Doctor Baz Mohammad told me: "We are running out of medicine. We can't even provide first aid."
In the middle of all this chaos, people continued to search for family members. One of them, Ghulam Sanayi, said he had not heard from his brother, a shopkeeper, since the morning. "I have been going from one hospital to another the whole day."
People were also running out of food. There were only two bakeries in the whole city still open. One single piece of bread now cost 50-60 Afghanis (£0.54-0.64; $0.70-$0.85). It had been only 10 Afghanis two days earlier.
Sunday, 12 August - 'They stopped those fleeing the city'
Fighting continued on the third day. I could not remove the images of utter chaos at the hospital from my head as I decided to flee the city.
It was evening and dark outside. I saw four military humvees in the north of Ghazni. There were security forces personnel standing around them, stopping those who were trying to get out and asking them questions.
I was stopped too. I told them I was going to a nearby village just outside the city. They let the group I was with go. Moments later, we were on the road to Kabul, 90 miles (148km) north.
Taliban fighters tried to stop our vehicle when we reached the Sayed Abad area of Wardak province, about halfway there. Our driver turned around smartly and sped away. After driving through many villages we finally arrived in Maidan Shar, an hour from Kabul.
After three days of terror, we were out of danger.