There was a thump, the emergency-exit door swinging open. Then a flood of light pouring into the darkness. A figure wearing a gas mask and black body armor stepped into the theater.

The man paused. In the second row, Jennifer Seeger thought he might have stood there a full minute.

“Maybe he’s just dressing up and being silly,” she thought. After all, this was a midnight showing of “The Dark Knight Rises,” Hollywood’s latest Batman movie. If there was ever a place where a masked stranger in black might not cause alarm, this was it.

Police would later say that the stranger — allegedly James Holmes, 24 — seemed to have prepared meticulously. In that moment, he waited.

Then, “he took his grenade and he threw it into the crowd,” Seeger said, referring to a canister of an unknown gas. “Then he took his first gunshot, and that’s when everybody knew he wasn’t playing around.”

The rampage that began in that moment early Friday morning killed 12 people and injured 58 others in this middle-class neighborhood outside Denver. The mass shooting echoed earlier attacks — Columbine, Fort Hood, Virginia Tech — where madness descended without warning, jolting the nation and setting off a search into the background of an apparently troubled assailant.

This time, the suspect is a graduate student at the University of Colorado at Denver who was in the process of withdrawing from his neuroscience program. Police captured him just outside the theater without a fight.

The only near-certainty is that the gunman acted alone and not as part of a terrorist group or other conspiracy. Federal law enforcement sources said that Holmes bought a ticket, entered the theater, then left and returned through the emergency exit.

“We are not looking for any other suspects,” Aurora Police Chief Dan Oates told reporters. “We are confident that he acted alone, but we will do a thorough investigation to make sure that is the case.”

Seeger and other witnesses recounted scenes of chaos and bloodshed inside Theater 9.

Chris Ramos, 20, a Starbucks baristo seated in the fifth row, said the attack began about 20 minutes into the movie.

“The first sign that something was wrong was when the guy next to me got shot,” said Ramos, who attended the premiere with his sister and two friends. “I shielded my 17-year-old sister on the floor. I started crying, not because I was afraid, but because the tear gas started to burn my eyes.”

The gunman looked calm and uttered not a word as he walked up an aisle, firing as he went, moviegoers said, and igniting panic.

Ramos said that he was kicked in the face several times by people trying to get up off the floor and out of the aisle. He estimated that the shooting lasted about a minute and a half.

Seeger said that the assailant pointed a gun at her, and that she had an odd thought in the terrifying pause that ensued. “I was like, you know, ‘I can’t die in a “Twilight” T-shirt,’ ” said Seeger, 22, who is in training to be a firefighter and an emergency medical technician. She dived away, then lay still as the gunman walked up and down a side aisle. She said a shell casing rolled down the sloped theater floor and she felt its heat against her face.

Salina Jordan, 19, was in an adjoining theater watching the same film when she heard a series of pops. “It was so in sync we thought it was part of the movie,” she said. “We thought it was a special effect because they were trying to do it up big for opening night.”

Then bullets began piercing the wall. A teenager to Jordan’s right was shot in the jaw. A fire alarm went off.

The theater complex, set in the parking lot of a large shopping mall, is just a few blocks from the Aurora police headquarters. The first of scores of responding officers arrived 90 seconds after receiving the first 911 call at 12:39 a.m., authorities said.

In the lobby near the concession stands, SWAT teams trained their guns on Theater 9. They directed frightened patrons to remain in place — or to run for the exits — as gunfire started and stopped. Jordan said she watched a police officer carry out the inert body of a girl who appeared to be about 9.

“She had been shot through her stomach, and the blood was just coming out,” Jordan said. “Her body was so limp. And her face — there was no life in her face.’’

Police almost immediately arrested Holmes, who was next to his white Hyundai outside a rear entrance of the theater. Oates said he was wearing a ballistic helmet, bulletproof vest, leggings, throat protector, groin protector, gas mask and protective gloves.

Federal law enforcement sources said that all four guns they think were used in the attack — two Glock pistols, a Remington 12-gauge shotgun and a Smith & Wesson AR-15 assault rifle — were purchased legally over the past two months from local branches of two national chains: Gander Mountain and Bass Pro Shop. Oates said Holmes had bought 6,000 rounds of ammunition online.

Authorities removed the bodies of 10 victims that remained in the theater. Oates said police are working as quickly as possible to identify them and notify their relatives.

The theater’s parking lot made an eerie scene later Friday. Most of the lot had been cleared out, but a few scattered cars were parked in the bright sunshine. Behind the theater, a police officer was guarding Holmes’s car. A few feet away, a purple theater exit door appeared to be propped open.

Among the known dead is Jessica Ghawi, said her brother, Jordan Ghawi. She was an aspiring sports journalist who had recently survived a shooting at a mall in Toronto. She had tweeted from the theater shortly before the massacre that she was eager to see the movie.

The Pentagon said that three military personnel were injured in the shooting and that another service member at the theater remained unaccounted for.

Police said 30 shooting victims remain hospitalized, 11 of them in critical condition. James Denton, trauma director at the Medical Center of Aurora, one of several hospitals treating victims, said 12 were admitted with gunshot wounds and three were treated for chemical exposure. The victims ranged in age from 16 to 31.

President Obama and Republican presidential challenger Mitt Romney expressed condolences, canceled campaign events and suspended advertising in Colorado.

Noting that his two young daughters like to go to the movies, just like millions of other Americans, Obama, speaking in Fort Myers, Fla., said that he and first lady Michelle Obama would “hug our girls tighter tonight.”

The shooting is a “reminder that life is fragile,” he said. “Our time here is limited, and it is precious.”

Romney, at an appearance in Bow, N.H., said he spoke “not as a man running for office but as a father and grandfather, a husband, an American. This is a time for each of us to look into our hearts and remember how much we love one another and how much we love and how much we care for our great country.”

In Aurora, police converged on Holmes’s apartment about 2 a.m. Friday, after he indicated that it contained explosives. Inside, police found a set of tripwires on the front door, a law enforcement official said. They were set near the floor and attached to a series of containers — some of which appeared to be five-gallon gasoline canisters — filled with an unknown liquid. They were mainly in the living room.

On Thursday night, before the shootings, the official said, Holmes blasted loud techno music in his apartment. The official said that his intent may have been to elicit a noise complaint, and draw police or others to open the booby-trapped door. The source said this setup — if it indeed involves explosives — appeared to be more sophisticated than 90 percent of homemade explosives, because it appeared to be “victim-initiated,” instead of set off by the suspect.

Holmes, who is scheduled for a preliminary court appearance on Monday, had no previous contact with the Aurora Police Department, aside from a 2011 traffic summons for speeding, Oates said. Although much of his background is still unknown, some initial details touched grimly familiar notes.

He was “very quiet, strangely quiet in class” and he seemed “socially off,” said a University of Colorado neuroscience faculty member, who spoke on the condition of anonymity because of privacy concerns and said he taught Holmes in a class at the school’s medical campus.

When the faculty member heard Holmes’s name in connection with the shootings, he said he thought the suspect could well be his student. He added that Holmes did very poorly on comprehensive exams last semester and that school officials contemplated putting him on academic probation.

In San Diego, a woman contacted by ABC News told reporters that she was Holmes’s mother. She said she had awoken unaware of the massacre and had not yet been contacted by authorities, but immediately expressed concern to ABC that her son may have been involved.

“You have the right person,” she said. “I need to call the police. . . . I need to fly out to Colorado.”

Horwitz and Turque reported from Washington. William Branigin, Carol D. Leonnig, Jerry Markon, Craig Whitlock, Debbi Wilgoren, Julie Tate and Jennifer Jenkins in Washington and special correspondents Sandra Fish and Stephen Singular in Colorado contributed to this report.