One survivor thinks as many as 17 people may have died trying to get out through the emergency exit that would not open.

WELLINGTON, New Zealand — 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."

Alayedy and other survivors of the March 15 mosque attacks in New Zealand have 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.

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. 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. 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 happenstance, 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."

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.

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.

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."

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.

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.

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.

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.

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, Alnobani said, that man was shot. The gunman walked out of the mosque to get another gun from his car, 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.

"And he was actually standing behind them, and he was shooting and shooting and shooting and shooting," 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.

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.