CENTENNIAL —On the day in June that James Holmes failed the crucial oral examination for his neuroscience program at the University of Colorado Denver, he bought an assault-style rifle.

Also in June, the same month that professors told Holmes that perhaps he wasn’t cut out for a career in neuroscience, he quietly stockpiled explosives.

Holmes also made threats in June that prompted CU officials to contact police.

That confluence of events was laid out Thursday in an Arapahoe County courtroom by the lead prosecutor in the case against Holmes, the suspect in the Aurora theater massacre.

In the court hearing, which centered on access to education records related to Holmes, prosecutors from the county district attorney’s office sought to draw a straight, bold line between Holmes’ purported academic failings at CU and the events of July 20, when authorities allege Holmes walked into an Aurora movie theater and killed 12 and injured 58 others in one of the worst mass shootings in American history.

Thursday’s details marked the most extensive explanation authorities have offered to date as to the motive behind the shooting. And it means prosecutors and Holmes’ defense team — which disputed the details of the prosecution’s account — have now staked out opposing narratives for what allegedly led Holmes to the movie theater for a midnight screening of “The Dark Knight Rises.”

In a previous hearing, Holmes’ attorney Daniel King has suggested that his client is mentally ill. Prosecutors, meanwhile, on Thursday portrayed Holmes as isolated and dejected after the collapse of his goal to become a neuroscientist.

“When that goal does not end up being reached, … all of that is relevant to his decision to withdraw from school, booby-trap his apartment, buy ammunition and explosives, and commit this act,” Karen Pearson, the case’s lead prosecutor, said in court Thursday.

Denver attorney Craig Silverman said prosecutors appear to be trying to shift the focus of the case away from Holmes’ mental health and instead recast the shooting as an act of revenge.

“The prosecution is starting to build a case that these murders were a response to a broken relationship between Holmes and CU,” Silverman said.

Holmes failed his oral exam June 7, Pearson said. That is the same day authorities have said Holmes bought a semiautomatic rifle, one of three guns officials say was used in the attack.

Also in June, Pearson said Holmes made threats that so worried CU officials that they contacted police. She didn’t specify what the threats were.

Aurora police Chief Daniel Oates said Thursday his department was not notified of any threats, either by CU leaders or by the campus police department.

“We didn’t know about any of this before the shooting,” Oates said.

King suggested the prosecution has its facts wrong. “I would question the validity of some of that,” King said of Pearson’s statements.

During the hearing, Pearson said Holmes was banned from the CU campus and had his key-card access to secure areas of buildings on the Anschutz Medical Campus revoked. But CU spokeswoman Jacque Montgomery asserted that neither was true.

Montgomery said Holmes voluntarily withdrew from the neuroscience program. His key card was deactivated after his withdrawal, as it would be for any student, Montgomery said.

King, meanwhile, said information about Holmes’ time at CU is largely unconnected to the case.

“Motive is not an element of any crime charged here,” King said. “It is irrelevant what the motive is.”

Holmes’ education records are important because prosecutors say they need them to prepare for a hearing scheduled for Thursday over what could be the biggest clue to the planning and motivations behind the theater massacre. At that hearing, the two sides are expected to debate whether a notebook Holmes mailed to his psychiatrist at CU is a confidential doctor-patient communication.

Holmes’ defense team has argued in a motion that the notebook is protected by doctor-patient confidentiality and should be returned to Holmes. The prosecution countered that the notebook is not protected and should be available as evidence.

In order to determine who is right, 18th Judicial District Chief Judge William Sylvester must wade through details about when Holmes started visiting the psychiatrist, Dr. Lynne Fenton; when the treatment relationship ended, if at all; and whether Holmes did anything that would have waived the usual doctor-patient privilege.

To prepare for that hearing, prosecutors said they needed access to roughly 100 pages of education records that a CU lawyer turned over to the court in a sealed envelope last week in response to a subpoena. Holmes’ attorneys objected to the release of documents — even objecting to the judge’s looking over the records in his office — and that debate was the subject of much of Thursday’s hearing.

King said the prosecutions’ bid for CU records is an overbroad effort to dig up whatever they can on Holmes, even if those records should be confidential.

“This is quite literally nothing other than a fishing expedition,” King said.

But Pearson countered that the CU records are relevant to the case.

“What’s going on in the defendant’s life at this time is extremely important to this case,” she said.

Sylvester did not rule publicly whether prosecutors could have the documents.

As for the man in the middle of the argument, Holmes sat impassively throughout the hearing. His wrists were shackled. His hands were folded in his lap. His eyes looked blankly downward.

In the audience sat a young woman who said she was in the theater during the shooting. She would give her name only as Nicole.

“Just being in the same room,” she said of the hearing, “gives you an unsettling feeling in your stomach.”

John Ingold: 303-954-1068, jingold@denverpost.com or twitter.com/john_ingold

James Holmes timeline

March 2011: James Holmes accepts the University of Colorado’s offer to join the neuroscience graduate program.

May 2011: Holmes moves to Denver, renting an apartment at 1690 Paris St. in Aurora.

June 2011: Holmes starts classes at CU Denver.

Oct, 28, 2011: Holmes is ticketed for driving 46 mph in a 35-mph zone.

April 28, 2012: Holmes makes his last posting on the dating website OKCupid.

May 22, 2012: Holmes buys the first of two Glock pistols at Gander Mountain in Aurora.

May 28, 2012: Holmes buys a Remington 12-gauge shotgun at Bass Pro Shops in Denver.

Early June 2012: Dr. Lynn Fenton, a psychiatrist, calls members of campus BETA team with a report about Holmes, according to anonymous sources.

June 7, 2012: Holmes buys a Smith & Wesson M&P15 at Gander Mountain in Thornton.

June 7, 2012: Holmes takes and fails his oral board.

June 10, 2012: Holmes officially withdraws from CU Denver.

July 2, 2012: Holmes places $306 order with TacticalGear.com for a combat vest, magazine holders and a knife, paying extra for expedited two-day shipping.

July 5, 2012: Holmes signs up for an account on AdultFriendFinder website.

July 6, 2012: Holmes returns to the Bass Pro Shops store in Denver and buys another Glock pistol.

July 20, 2012: Holmes is accused of an early-morning shooting rampage inside an Aurora movie theater that kills 12 and injures 58 people.