Before he allegedly walked into the Batman movie early Friday in Aurora, Colo., dressed head to foot in black body armor and carrying a handgun, a shotgun and an assault rifle, James Holmes was a graduate student in neuroscience — a PhD candidate who sat in classes with titles such as “Biological Basis of Psychiatric and Neurological Disorders.”

He was known as a very quiet young man, introverted but pleasant. Holmes, 24, had shown scholarly promise in the recent past. He’d earned a merit scholarship out of high school in a sunny San Diego suburb. He had graduated from college with honors. From there, he’d gone to graduate school at the University of Colorado at Denver.

And then something changed. By this spring, Holmes had begun to struggle with poor test scores. He eventually decided to quit school.

The next step, the alleged descent into horrific violence, remains mysterious.

As of Friday evening, no one had emerged to speak on Holmes’s behalf. He will appear in court Monday and is expected to be formally charged a few days later.

What’s certain is that the killer planned his crime carefully, gearing up as if he were a commando, or a bad guy in a movie, before invading the Century 16 movie theater in Aurora during a midnight screening of “The Dark Knight Rises.”

The shooter wore a ballistic helmet, ballistic vest, ballistic leggings, a throat protector, a groin protector, gloves, a gas mask — all black. Police say Holmes killed a dozen people and left 58 others injured, many critically with gunshot wounds, before surrendering without incident when police confronted him behind the theater.

Police would not discuss any motive for the massacre. They said Holmes revealed to them during questioning that there were explosives in his apartment in Aurora. They went to the complex and, peering through a window, discovered that it was booby-trapped with multiple chemical and incendiary devices linked by wires.

What happened in Aurora had a grisly echo of another massacre in a Denver suburb, that at Columbine High School in Littleton in 1999. Both had elements of theatricality and a clear desire for maximum casualties and publicity.

Michael Welner, a forensic psychiatrist who, as chairman of the Forensic Panel of New York City has studied and testified about mass shootings, said these cases invariably feature a person who is highly paranoid, resents the broader community and decides to kill out of a desire to achieve notoriety.

“They’re people who are unfailingly unable to form satisfying sexual attachments, and their masculinity essentially gets replaced with their fascination for destruction,” Welner said. “The overwhelming majority of folks who do this are male because of how, in our culture, masculine identity is so closely tied to the capacity to destroy.”

But Jeffrey Swanson, a professor at Duke University School of Medicine who is an expert on violence and mental illness, said people should not jump to conclusions about why a person becomes a mass killer.

“They tend to be young and male and tend to be sort of isolated. The problem with that is that there are tens of thousands of people who meet the same description and never do anything like this,” Swanson said.

Holmes went to Westview High School in the upscale San Diego neighborhood of Torrey Highlands, where his parents, Robert and Arlene Holmes, moved in 2005. Westview classmate Breanna Hath, who now works as a nurse, said she remembers Holmes as extremely quiet and “really sweet, shy. He didn’t have any creepy vibe about him at all.”

Hath said Holmes lacked self-confidence.

“There were no real girls he was involved with. . . . It seemed he was really into a video game group that hung out together.”

Another classmate, John Kabaci, said, “There was nothing negative or weird about him — he just stuck to himself.”

The theme was repeated by Darryl Guiang, another high school classmate: “He seemed like a really shy kid.”

Holmes earned his undergraduate degree in neuroscience at the University of California at Riverside, graduating with honors in 2010. “He had the capability to do anything he wanted academically,” Timothy White, chancellor of UC-Riverside, said at a news conference Friday.

Holmes appears to have never had a scrape with the law, other than a speeding ticket last year. UC-Riverside said he never got into trouble as an undergraduate.

The photograph of Holmes released by the graduate program in Colorado shows a clean-shaven, boyish young man with a cheerful expression on his face.

A spokeswoman for the San Diego Police Department handed out a statement on behalf of the Holmes family and asked the media to respect its privacy, along with that of neighbors.

“The Holmes family is very upset about all of this. It is a tragic event, and it has taken everyone by surprise,” the police spokeswoman said, adding that the family is “fully cooperating” with investigators. “As you can see from their statement, their hearts go out to the friends and family of those that were involved.”

Holmes kept a low profile while living in an apartment building near the medical campus. Neighbors said they didn’t know him.

On the dating site Adult Friend Finder, a post bore a photo of a man with dyed orange hair who appears to be Holmes. The FBI was investigating Friday night but had not confirmed its authenticity. In the post, the man, “classicjimbo,” describes himself as “looking for a fling or casual sex gal. Am a nice guy. Well, as nice enough of a guy who does these sort of shenanigans.” In another part of the page, he asks: “Will you visit me in prison?”

A neuroscience faculty member at the University of Colorado at Denver, who spoke on the condition of anonymity because of privacy concerns, described Holmes as “very quiet, strangely quiet in class” and said he seemed “socially off.” Although Holmes got weak scores on the comprehensive exams last semester, the educator said, the school’s staff wasn’t going to toss him out. Instead, they planned to give him remedial instruction and perhaps put him on academic probation.

Sari Horwitz, Jennifer Jenkins, Jenna Johnson and Julie Tate in Washington and Sandra Fish in Aurora, Colo., contributed to this report.