Last August, outside Abu Zaabal, 37 prisoners trapped in the back of a van were allegedly gassed to death having been held for six hours in temperatures close to 40C. Patrick Kingsley talks to the survivors and, for the first time, reveals their side of the story

Some time after midday on Sunday 18 August 2013, a young Egyptian film-maker called Mohamed el-Deeb made his last will and testament. It was an informal process. Deeb had no paper on which to sign his name and there was no lawyer present. He simply turned to the man handcuffed next to him and outlined which debts to settle if he should die, and what to say to his mother about the circumstances of his death.

Deeb had good reason to fear for his life. He was among 45 prisoners squashed into the back of a tiny, sweltering police truck parked in the forecourt of Abu Zaabal prison, just north-east of Cairo. They had been in the truck for more than six hours. The temperature outside was over 31C, and inside would have been far hotter. There was no space to stand and the prisoners had had almost nothing to drink. Some had wrung out their sweat-drenched shirts and drunk the drops of moisture. Many were now unconscious.

Most of the men inside that van were supporters of Mohamed Morsi, Egypt's first elected president. Squashed against Deeb was Mohamed Abdelmahboud, a 43-year-old seed merchant and a member of Morsi's Muslim Brotherhood.

Following four days of mass protests against his year-long rule, the army had overthrown Morsi and the Brotherhood in early July. In response, tens of thousands of people camped outside the Rabaa al-Adawiya mosque in east Cairo to call for the president's reinstatement. Within a week, the space outside Rabaa turned from an empty crossroads to a sprawling tent city that housed both a market and a makeshift field hospital. At Rabaa's centre was a stage where preachers led prayers and firebrands spouted sectarian rhetoric. At its edges were a Dad's Army of badly equipped guards, dressed in crash helmets and tae kwon do vests, standing before a series of walls built of stones ripped from pavements. From behind these barricades, two or three times a day, protest marches would snake into nearby neighbourhoods, blocking major thoroughfares and paralysing much of the city. Clashes between armed police and protesters claimed more than 170 lives.

A woman mourns at a makeshift morgue following the dispersal of the crowds gathered at Rabaa. Photograph: Mosa'ab Elshamy/EPA

For Islamists, Rabaa was one of the last remaining symbols of freedom. But for the millions who opposed Morsi, it was a hideout for violent extremists who were holding the country to ransom. Confrontation became inevitable. On Wednesday 14 August, some time after 6am, police and soldiers surrounded the camp, which still contained thousands of women and children. In the 12-hour operation that followed, more than 900 protesters were shot dead, many by sniper fire. A group of armed protesters fought back, killing nine policemen, according to Human Rights Watch. But they were vastly outnumbered. As police locked down the streets around the camp, they arrested thousands – not just Morsi supporters, but also dozens of residents and workers caught in the wrong place at the wrong time.

On Sunday 18 August, Professor Gamal Siam, an economist at Cairo University, arrived at the office of Egypt's chief prosecutor, Hisham Barakat. His oldest son, Sherif, had been arrested the previous Wednesday, during the crackdown at Rabaa. But there had been a mistake, his father told the chief prosecutor, and he needed help.

Sherif Siam was not a member of Morsi's Muslim Brotherhood, nor even a Morsi supporter. Sherif had said on Facebook that the president's overthrow had been not a coup, but a revolution. Certainly, he had visited the camp at Rabaa al-Adawiya two or three times, but he'd been to anti-Morsi marches, too. When the news broke of the Rabaa camp's dispersal, his father said Sherif went down to help the wounded.

Gamal Siam, whose son Sherif, a telecoms engineer and life coach, died in the van. Photograph: Mosa'ab Elshamy for the Guardian

On some level, Barakat sympathised. He gave Sherif's father a signed letter to present to prison officials, to help speed up the processing of Sherif's case. But what neither Barakat nor Siam knew was that it was already too late.

A few minutes earlier, in the back of an overcrowded police van on the other side of Cairo, Sherif Siam – and 36 others, including Deeb – had been gassed to death.

The next day, footage emerged (warning: upsetting images) of the 37 corpses on their arrival at Cairo's main morgue. Most of the bodies were bloated, their faces red or black. Deeb's face was one of the few that was unmarked. But Sherif Siam's was swollen and blackened, almost beyond recognition.

What had happened was soon blamed on the prisoners. Police officials said the 37 died shortly before they were due to be handed over to the warders at Abu Zaabal prison, just north-east of Cairo. According to their narrative, the prisoners kidnapped a policeman who opened the door to let them out, prompting his colleagues to fire tear gas inside the truck to subdue them. State media outlets went further, claiming that Muslim Brotherhood gunmen had attacked the van to try to free those inside, and the prisoners died in the ensuing clashes.

Whatever the truth, the news cycle quickly moved on. In a week of horror, other atrocities soon grabbed Egypt's attention. The next day, 25 police conscripts were killed in cold blood in Sinai by Islamist extremists angered by Morsi's removal. The massacres of the previous week – at Rabaa and at Ramses Square – still dominated the media narrative, as did the grotesque Islamist-led revenge attacks on dozens of Christian churches and police stations. Four of the 15 policemen who accompanied the truck were subsequently put on trial for negligence. But that trial was postponed indefinitely in January – and government officials are still able to claim the deaths were provoked by the prisoners.

But they reckoned without the incident's eight survivors, four of whom remain in jail, as well as some of the policemen who drove them to the prison. Five months on, their collected testimonies for the first time reveal a different story – one of police cruelty and a subsequent cover-up that starts not at lunchtime on Sunday 18 August, but on the previous Wednesday, when the 45 prisoners were among thousands arrested in and around the Rabaa al-Adawiya encampment.

A screenshot from amateur footage of Sherif’s arrest.

Police had seized Sherif at around midday a few streets from the camp, where shooting had started six hours earlier. Amateur footage shows him in a blue shirt being led by officers towards a police van, when another officer sprints towards Sherif and fells him with a flying kick to the chest.

Like the thousands of others arrested that day, he was accused of a raft of catch-all charges, including membership of a terrorist group (as the state later designated the Muslim Brotherhood), attempted murder and possession of lethal weapons. It is impossible to know the precise circumstances of his arrest, but for his family, these are preposterous charges. He was a telecoms engineer by day, and had a second career as a life coach. Four days before his arrest, he was interviewed on Egyptian breakfast television about how to find happiness amid the tension and disruption wrought on Cairo by the Rabaa camp.

According to the survivors, Sherif Siam was one of at least eight victims at Abu Zaabal who were either opponents of Morsi, or had no connection to the Rabaa camp. Shukri Saad, a resident of Nasr City, the area surrounding Rabaa, had just bought a month's worth of diabetes treatment when he was stopped by police. They suspected him of buying medicine for people wounded at Rabaa. "I'm not Muslim Brotherhood, I'm NDP," Saad reportedly screamed as he was flung in a police van, in reference to the party of Morsi's predecessor, Hosni Mubarak.

Nearby, Talaat Ali was serving tea to off-duty soldiers and policemen on a break from clearing the camp. The cafe owner decided to close early, because the officers refused to pay for their drinks, so Ali started to make his way home. He said he was stopped by the same policemen he had served. "Hey, I'm the tea guy, I gave you tea," Ali apparently said before he, too, was arrested.

He was soon joined by Mohamed Ramzi, a vegetable seller from west Cairo who had come to Nasr City to sell cucumbers. Then there was Ahmed Hamrawy, on his way to sell his clothes in a market in the centre of town. Rafiq Abdelghany was stopped on his way to work, and would later be granted bail – but he was taken to Abu Zaabal before the bail money could be delivered. A card-carrying member of Ghad el-Thawra, a prominent liberal party, was also rounded up. Nasr City had become a military zone: a curfew had been imposed and anyone moving around was arrested.

Mohamed Abdelmahboud was arrested far from the camp, several hours after the shooting had stopped, as he drove home. He had been at Rabaa since its tents were first pitched in late June. When the siege began, he stayed put. A group of Morsi supporters returned the soldiers' fire, in a hopeless attempt to hold off a security force that included snipers on surrounding roofs and that exacted many more casualties than the small defence squad.

Abdelmahboud says he stayed behind to help the wounded. After 3pm, once the gunfire became too intense to rescue any more of the injured, he made a run for it. Later, he joined up with a group of friends from his home town, a tiny hamlet down a backroad in the Nile delta. They had heard that a friend had been shot in the chaos and they were looking for his body at the Iman mosque, a few streets east of what had been the Rabaa encampment. The air there stank of an odd blend of joss sticks and rotting flesh – it was a smell Abdelmahboud and his friends would grow used to as they spent the evening picking through the long rows of corpses. Some were burnt through, unrecognisable, like logs in a bonfire.

A few metres away, Gamal Siam was searching for his son. Close to midnight, he was shown a YouTube video of Sherif getting a kicking from a police officer. "I was so pleased, even though what it showed was so inhuman," Siam said later. "At least he was alive."

Abdelmahboud and his friends stumbled across their friend. They put his body in the back of a pick-up truck and began the drive home to Sharqiya – a northern province two hours north-east of Cairo – for his funeral. There were around two dozen of them huddled over the corpse, making their way through the darkness. Ten miles into the journey, an army checkpoint loomed in the headlights. A curfew had been called to control the spread of violent clashes, and they were breaking it. "The soldiers got us out and started harassing us," Abdelmahboud said. "Where did we get the body from? Did we have permission to bury him?"

The soldiers took the men's belongings and their money, and called the police. After an hour, they released most of the villagers, but kept back five, seemingly at random. Abdelmahboud was one; Abdel Moneim, the local physician, was another. "They said there were warrants out for our arrests," said a third, Mohamed Sayed Gabal, a 29-year-old pharmacist. "That was surprising, because none of us had ever been involved with the police before."

The five were hauled back to north-east Cairo, to a police station in Heliopolis, a few hundred metres from the presidential palace. There, they were accused of carrying a corpse without a permit and of vandalism, and thrown into a crowded cell just as dawn was breaking.

Hussein Abdel Aal, a 60-year-old former official at an Egyptian oil company, had spent the night in custody, lying on a football pitch with thousands of other prisoners: so many people had been arrested in and around Rabaa that detainees were taken to Cairo stadium on Wednesday night, until space became available in the city's police stations.

Abdel Aal had arrived at Rabaa a few hours before it was cleared. There had been rumours that the soldiers would make their move on the camp that morning, and such was Rabaa's symbolism that he wanted to be there when it fell. He also wanted to stand alongside his son, Ramzy, a Brotherhood official who had been at the camp from the start.

As the violent clearance began, Ramzy was shot by a sniper from the top of a nearby building. "We were far from the frontline, but my son got a bullet in his forehead," his father later remembered, "and it went out of the back of his skull." Ramzy's friends took his body to a field hospital set up by the Muslim Brotherhood in a corner of the camp. But when the building filled with tear gas, they were forced to move, and managed to find a car to take them to a private hospital.

At its gates, an army officer stopped the vehicle and ordered Abdel Aal out. "I begged him to let me stay," he said when I spoke to him last November. "I told him: 'I'm willing to kiss your feet – just let me stay with my son.'" Instead, he was arrested and taken to Cairo stadium, where police treated him "like an animal", punching and cursing him, and confiscating his money and mobile phone.

Elsewhere on the pitch, Sherif Siam met someone who still had his phone, and used it to post his whereabouts on Facebook: "Whoever sees this, tell my father I am in Cairo stadium."

When the curfew ended the next morning, Gamal Siam set about trying to find a lawyer to help free his son. Siam was a connected man – he was once an adviser to the Mubarak-era agriculture ministry – but none of his friends dared get involved. "Every lawyer," Siam said, "was worried about seeming to help the Brotherhood." So Siam went to the stadium himself, but by the time he arrived on Thursday morning, Sherif had already been taken to the police station in Heliopolis.

The cells were only about 3 metres long, and the prisoners were tightly packed in. According to Abdelmahboud, over the next three days there were at times as many as 38 prisoners to a room. It was too cramped for them all to lie down at once, so they would sleep in shifts – half of them standing while the other half slept. They were allowed out only twice a day, to be counted. The last one back into the cell would be beaten. "We were like sheep while we were going back, stumbling and stepping on each other in order not to be the last one," Abdel Aal said.

The heat was stifling. One night most of the men stripped down to their underwear to keep cool. "That's when Sherif took off his shirt and started fanning people," Abdelmahboud said.

Though most of them had been at Rabaa, the majority did not know each other, so they spent Thursday to Sunday swapping arrest stories. The survivors remembered Sherif for his humour. "He always used to joke – but just empty jokes," Sayed Gabal said. "No deep conversations."

After visiting three different police buildings, Gamal Siam and his family finally tracked Sherif to Heliopolis on the Friday. At first police denied he was inside, but after some arguing they were allowed to see him. Sherif wouldn't talk much, and didn't say a lot about how he was arrested. But he broke down in tears as his father hugged him.

Sherif was calmer when his father returned on Saturday evening. "He asked us to bring him a toothbrush and personal hygiene things," Siam said. "And he asked us to bring ice-cream for everyone." It was the last time the two would talk.

Mohamed Abdelmahboud, one of eight survivors out of the 45 prisoners on board Photograph: Mosa'ab Elshamy for the Guardian

At around 6.30am on Sunday 18 August, 45 prisoners were handcuffed in pairs, apart from Mohamed Abdelmahboud, who was attached to two men. The five from Sharqiya were the last to be crammed into the back of the van, which was already full by the time their turn came.

"I said to the officer: how can we fit in there?" Sayed Gabal said. "He said the car fits 70, and shoved us inside." An engineer's report specially commissioned by prosecutors later said the van's maximum capacity was 24. With 45 crammed inside, the police struggled to close the door.

It took just over an hour for the van and its escort vehicles to reach the prison. Inside, the men were squashed against each other, and most could not stand properly. "If there was a bump," Abdelmahboud said, "everyone was thrown up and down."

Things worsened once they reached the forecourt of the prison. Driving there, breathing had been easy enough: a breeze blew through the van's four grilled windows, creating ventilation. But once the van parked at the prison, the airflow stopped and the men inside struggled to breathe.

What happened next was the subject of an inquiry in which one of the police guards gave an account that corroborates the surviving prisoners'. The policeman concerned, Abdelaziz Rabia Abdelaziz, whose rank loosely translates to sergeant, declined to be interviewed for this article; but his testimony to the prosecution was revealed by the survivors' lawyers, and confirmed by two other police sources.

Abdelaziz claimed the van's ventilation tubes were broken. Captain Amr Farouq, the leader of the convoy, said he had personally inspected the ventilation system and found it in working order.

The temperature near the prison that August day peaked at 31.1C. The 45 men in the van were forced to wait as more than 600 of those captured near Rabaa were delivered to Abu Zaabal. There were around 15 trucks waiting in the forecourt and each one took about half an hour to unload: time had to be set aside for a traditional prison welcome – the beating of the prisoners as they left the vehicles (an experience that would later be described in detail by two Canadians who were also arrested in the chaos that week). With the van from Heliopolis 11th in the queue, the prisoners were in for a long wait.

The heat became unbearable, the survivors said. People were standing on one leg, and their clothes were drenched in sweat. "We started to get short of oxygen," Abdelmahboud said, "and people started to shout for help. We started banging on the walls, we started screaming, but no one answered."

Hussein Abdel Aal, whose life was saved because he was standing by the van door. Photograph: Mosa'ab Elshamy for the Guardian

As time went on, 60-year-old Hussein Abdel Aal and Shukri Saad, the diabetic, were particularly affected. "I felt like I was dying," said Abdel Aal, who had open-heart surgery two years ago. "After a while, I saw that the blacks of [Saad's] eyes had started to dilate and he started to pass out. We cried out that someone was dying. They called back that they wanted all of us to die."

According to the survivors, the policemen began to mock the prisoners. "They told us we had to curse Dr Morsi, in order to get out," Abdel Aal said. "So the young people started to curse him. But after that [the police] said we couldn't leave. Then they said: call yourselves girls' names. Some did. Then they said: we don't talk to women."

In his statements to prosecutors, Abdelaziz did not recall any policemen insulting those in the van, but he claimed that the dozen junior policemen guarding the vehicle repeatedly asked their four commanding officers – who were drinking tea some way off – for permission to open the van's doors and give the prisoners more to drink. "Every one of us went telling them the prisoners want to drink," Abdelaziz said. The officers refused all but one request: at some point between 10am and 11am, around four hours after the prisoners were first shoved inside, they were given water.

At first, the police could not open the door because the officers had lost the key. Instead, Lieutenant Mohamed Yehia took a piece of scrap metal lying nearby and used it to smash open the lock. Even then, most of the prisoners were kept inside. Only Abdel Aal, who was standing next to the door, was briefly allowed to stand on the ledge at the back of the van and splashed with water. Then he was pushed back inside. While other convoys left their van doors open once inside the prison walls, the Heliopolis policemen locked the broken door shut with a pair of handcuffs.

Captain Farouq claimed the prisoners were let out three times in all, a claim denied by both the survivors and Abdelaziz, who, barring a 10-minute toilet break, was at the scene throughout the day. In the end, he said, "we took it upon ourselves as guards to bring water in bottles and pour it through the windows".

Inside the van, in the midday heat, the prisoners had reached breaking point. Many were delirious, some were giving each other messages for their families. "People started passing out, one after the other," Sayed Gabal said. "Of course, the elderly went down first. And the others started banging harder and harder. And outside they continued laughing and cursing Morsi."

Abdelaziz said it was obvious by this point that conditions inside the truck might cause the prisoners to suffocate, but he claimed that the four officers still refused to open the door. The truck eventually fell silent. Most of its occupants had collapsed.

Some time after 1pm, the prisoners who were still conscious heard shouting outside. It was their turn to disembark, the voices seemed to say, and they should prepare to hand over any remaining valuables to prison staff. But few of those inside could stand up.

What happened next is the subject of two vastly conflicting narratives. Farouq and most of his subordinates told investigators that, when the door was finally forced open, Lieutenant Yehia was pulled inside and held captive by the prisoners. The chaos brought more policemen from other convoys running to the van. Abdelaziz and another colleague were injured trying to rescue Yehia. In the commotion, and in an attempt to subdue the rioting prisoners, an unknown member of one of the police units fired a handheld canister of gas – issued to officers for their self-defence – through one of the side-windows. Yehia and two others were later taken to hospital for gas exposure, Farouq said, while Abdelaziz was treated for facial wounds.

But, according to the survivors and Abdelaziz, this version of events is a fabrication. "It didn't happen," Abdelaziz told the prosecution. He claimed that an officer later struck him across the face to make it look as if there had been a struggle. "Let's be logical," Abdelmahboud said. "We were so exhausted, we couldn't even walk. Most of us collapsed inside the van. Only five or six of us were able to stand. How could we possibly beat an officer?"

Egypt's interior ministry has not responded to requests for comment, or for interviews with police and prison personnel. But Abdelaziz's testimony indicates that the prisoners would not have been in any state to kidnap a guard.

Looking through the truck's back window, the policemen were met by a horrific sight. "Everyone inside was slumped over each other," Abdelaziz recalled.

Dr Hesham Farag, spokesman for the mortuary where the 37 casualties would later be taken for autopsy, said the men would still have been alive when the gas was fired, since traces of CS gas were found in each corpse's blood. He doubted that the single self-defence canister contained enough to kill so many men on its own, but it would have been the final straw for a group already starved for so long of adequate oxygen.

"We decided that the police [are] responsible for all these casualties, because they loaded the vehicle with 45 prisoners, which is a very large number, because the vehicle should carry no more than 24 people," Farag said in written testimony to the Guardian. "Therefore there was a lack of oxygen, which accelerated the deaths when tear gas was used."

Rather than blocking the door on purpose, the prisoners had simply been unable to move. Most of them were unconscious, the survivors said, while the few who were still just about conscious were handcuffed to people who weren't.

"I tried to wake one with my free hand," said Abdel Aal, who was still near the exit. "I punched him, God forgive me, but he didn't respond."

Abdelmahboud had been drifting in and out of consciousness. "The officer started asking us: who is behind the door?" he remembered. "We couldn't deal with the situation, we were in a very strange state, we couldn't move."

A lever was brought from the prison to force open the door and, when that was no use, a drill. At last, the policemen managed to force the door slightly ajar. Yehia squeezed inside, Abdelaziz said, and then they started dragging the prisoners through the small gap. Eight made it out alive, their skin badly scratched.

"Once I was out and smelled the fresh air, I couldn't feel anything and I fell on the ground," Sayed Gabal said. "Then they started beating us. There were two lines and they beat me while I was on the floor."

Once the bodies nearest the door had been cleared, the police were finally able to enter the truck themselves. "I found all the people inside were lying on top of each other," Abdelaziz said. There was a bad smell – something that made him gasp as he helped lug up to 10 more bodies out of the truck. As he carried them, a horrible realisation dawned on him: most of the men crammed inside that overheated van were dead.

"And then," Abdelaziz said, "the world became messy."

• Additional reporting by Manu Abdo.

• The headline and standfirst on this article were amended on 22 February 2014 to more accurately reflect the story.