When the gunman began to attack the Al Noor mosque, Ahmed Alayedy scrambled to get to the nearest emergency exit. He was the first one there.

“I tried to open the door,” he said. “But it doesn't open.”

Mr Alayedy and other survivors of the 15 March mosque attacks in New Zealand described to The Associated Press a scene of confusion and terror at the door on one side of the main prayer room, in the first accounts of the role the door played.

Mr Alayedy said so many people began crushing him against the door that some of his ribs cracked. Another survivor, Khaled Alnobani, says he thinks as many as 17 people may have died trying to get out through the door.

Investigators have likely examined a new electric locking system installed on the door in the days before the attack. The mosque says an electrician disabled that system the day before the attack, although some of those who escaped question whether that was the case.

New Zealand shootings: Victims of Christchurch mosque terror attacks Show all 11 1 /11 New Zealand shootings: Victims of Christchurch mosque terror attacks New Zealand shootings: Victims of Christchurch mosque terror attacks Zakaria Bhuiyan People gather hoping to find out information about Zakaria Bhuiyan who is still missing after the mosques shootings in Christchurch. David Moir/AFP New Zealand shootings: Victims of Christchurch mosque terror attacks Mucad Ibrahim Three-year-old Mucad Ibrahim, the youngest known victim of the mass shooting at two mosques in Christchurch, New Zealand, on 15 March 2019. Abdi Ibrahim via AP New Zealand shootings: Victims of Christchurch mosque terror attacks Nadeem Rasheed Nadeem Rasheed, brother of Pakistani Naeem Rashid who died alongside his son Talha Naeem, 21, who were killed in shooting at a Mosque in Christchurch, at their home town in Abbottabad, EPA New Zealand shootings: Victims of Christchurch mosque terror attacks Omar Nabi Omar Nabi speaks to the media about losing his father Haji Daoud Nabi, 71, in the mosque attack REUTERS New Zealand shootings: Victims of Christchurch mosque terror attacks Ash Mohammed Ash Mohammed, right, talks to a police officer about his father and two brothers who are missing near the Masjid Al Noor mosque AP New Zealand shootings: Victims of Christchurch mosque terror attacks Akhtar Khokhur Akhtar Khokhur, 58, shows a picture of her missing husband Mehaboobbhai Khokhar, 65. AP New Zealand shootings: Victims of Christchurch mosque terror attacks Wasseim Alsati A note is seen on a window of a door at the family home of Wasseim Alsati in Christchurch on 17 March 2019. AFP/Getty Images New Zealand shootings: Victims of Christchurch mosque terror attacks Haroon Mahmood Relatives offer condolences to nephew (centre) of Haroon Mahmood, a Pakistani citizen who was killed in Christchurch mosque shootings. AP New Zealand shootings: Victims of Christchurch mosque terror attacks Farid Ahmed Farid Ahmed (pictured) survived the Al Noor mosque shootings but his wife Husne was killed. AFP/Getty Images New Zealand shootings: Victims of Christchurch mosque terror attacks Syed Areeb Ahmed A relative shows a picture of Syed Areeb Ahmed, a Pakistani citizen who was killed the Christchurch mosque shooting. AP New Zealand shootings: Victims of Christchurch mosque terror attacks Naeem Rashid A relative looks at a picture on a mobile phone of Pakistani nationals Naeem Rashid and his son Talha Naeem (right) who died in the Christchurch shootings. AFP/Getty Images

What is clear is that nobody managed to open the door that afternoon.

With the gunman in the middle of the room, the door represented the only escape route for those on one side of him, at least until people started smashing windows to get out.

Fifty people were slaughtered by the gunman at two Christchurch mosques during the attack, including 42 who died at Al Noor. Mr Alayedy and others say that if the door had been wide open like it typically was during Friday prayers, many more people might have escaped.

Shagaf Khan, the president of the Muslim Association of Canterbury which oversees the mosque, said the door was closed and latched much like the front door of a house. He said it wasn't locked, although worshippers may have believed it was in the confusion.

He said an electrician had tested the new electric locking system on Thursday, and then disengaged it for Friday prayers. He said that to open the door, somebody needed to turn a lever. It was just coincidence, and perhaps the cool weather that day, he said, which meant the door wasn't wide open as usual.

“On any other Friday, the door would be open,” he said. “But on this Friday, nobody opened that door.”

He said he agreed that more people would have escaped if the door had been open.

“If it had been completely open, it would have been easy for people to get out,” he said. “But nobody was prepared for this.

"We were prepared for an emergency like a fire or an earthquake, and people would still have time to get out.

"This is something totally different. You don't put this in your emergency plan.”

Mr Alayedy said that in the confusion, he can't be sure if he simply failed to turn the lever properly or if something else stopped the door from opening.

Mr Alnobani, said he, too, tried to open the door and it didn't work, and he's familiar with the lever. He said he believes the door was electronically locked.

Simply pushing a button next to the door would have unlocked it, he said, but nobody knew about the new system.

New Zealand prime minister Jacinda Ardern vows not to say Christchurch shooter’s name

Mr Khan said the mosque was in compliance with regulations, which require emergency exits to be clear from objects, easily accessible, and unlocked.

Police said the scene examination is part of their investigation and they will not be commenting while the investigation is ongoing.

Robert Wright, the Christchurch City Council head of building consents, said in an email the mosque was in compliance with the Building Act at the time of the attacks and had a valid certificate known as a “Building Warrant of Fitness.”

Mr Alayedy, 30, said that on the day of the attack, he'd been listening to a holy speech by imam Gamal Fouda when he heard six or seven shots. He thought it was an electrical fault at first but then heard screaming and ran for the door.

“All the brothers come in behind each other, on top of each other,” he said.

Christchurch left devastated on New Zealand's 'darkest day' Show all 16 1 /16 Christchurch left devastated on New Zealand's 'darkest day' Christchurch left devastated on New Zealand's 'darkest day' The earthquake destroyed much of central Christchurch, including some of its most modern buildings REUTERS Christchurch left devastated on New Zealand's 'darkest day' An injured woman is helped to safety REUTERS Christchurch left devastated on New Zealand's 'darkest day' The crushed cupola of the Catholic Cathedral AP Christchurch left devastated on New Zealand's 'darkest day' People walk through debris in the aftermath of a 6.3 magnitude earthquake in Christchurch GETTY IMAGES Christchurch left devastated on New Zealand's 'darkest day' Rescuers search for survivors in a collapsed building in Manchester Street Getty Christchurch left devastated on New Zealand's 'darkest day' Rescue workers sift through the debris of a collapsed building after an earthquake rocked Christchurch AP Christchurch left devastated on New Zealand's 'darkest day' A man holds a child in his arms after an earthquake in Christchurch REUTERS Christchurch left devastated on New Zealand's 'darkest day' People walk through debris in the aftermath of a 6.3 magnitude earthquake in Christchurch GETTY IMAGES Christchurch left devastated on New Zealand's 'darkest day' A bus covered in building debris in Christchurch, New Zealand. GETTY IMAGES Christchurch left devastated on New Zealand's 'darkest day' Office workers are escorted out of the CBD Getty Christchurch left devastated on New Zealand's 'darkest day' Cars covered in building debris Getty Christchurch left devastated on New Zealand's 'darkest day' A man runs for cover Getty Christchurch left devastated on New Zealand's 'darkest day' Collapsed buildings in Manchester Street Getty Christchurch left devastated on New Zealand's 'darkest day' A man lies injured on Manchester street Getty Christchurch left devastated on New Zealand's 'darkest day' Collapsed buildings and debris along Manchester Street Getty Christchurch left devastated on New Zealand's 'darkest day' Bob Parker, the Mayor of Christchurch, talks to New Zealand Prime Minister John Key in the aftermath of the quake Getty

Because he couldn't open the door, he said, he tried punching the hexagonal piece of glass in the lower part of the door. When that didn't work, he drove his knee through it, shattering the glass, and then kicked it out. He crawled through and ran for safety.

Mr Alayedy, a chef from Jordan who moved to New Zealand nine years ago, said he thought about his family back at their house as he ran. His pregnant wife, his 3-year-old son, and the baby daughter they hope to have within the next couple of weeks.

Behind the mosque, Alayedy said, he began helping people to escape over a fence but couldn't get over it himself because of his injured ribs.

Another survivor provided a second escape route near the door by diving through a window with his arm wrapped around his eyes. Tarik Chenafa said he heard a "tat-tat-tat-tat-tat" and knew right away it was a semi-automatic weapon from his two years of compulsory military training in the Algerian army.

“I know someone is coming to kill us,” he said.

Mr Alnobani said that when he first came to the mosque that Friday, he'd noticed the side door was shut and considered opening it but then saw there were some older worshippers. It was a little cold and windy outside, he figured, so he left it alone.

Mr Alnobani said he also managed to crawl through the door's smashed glass and run. He returned to help rescue a young boy whose father was shoving him through the opening, he said, and then helped the father as well.

“I tried to save the child, and I thought maybe I lose my life,” he said. “But I am just alone,” he said, adding “He had more than me to lose.”

When he tried to help a third person through the opening, Mr Alnobani said, that man was shot. The gunman walked out of the mosque to get another gun from his car, Mr Alnobani said, and began shooting at him when he returned.

But he managed to escape, and then drove two injured people to the hospital.

The gunman acted quickly, mowing down people on both sides of the mosque. On the side opposite from the closed door, some worshippers were able to escape, but the gunman also killed many others as they tried to leave.

Support free-thinking journalism and attend Independent events

“And he was actually standing behind them, and he was shooting and shooting and shooting and shooting,” Mr Fouda, the imam, told the AP after the attack. “Tragedy. Tragedy.”

Brenton Tarrant, a 28-year-old Australian, has been charged with murder in the attack. His next court appearance is scheduled for April 5.

Mr Chenafa said he's still sad and confused, and finds it hard to sleep. And he doesn't know what to believe about the door.

“There will be a lot of waiting to find out the truth,” he said.