AURORA, Colorado — The suspected Batman movie premiere gunman was seeing a university psychiatrist specializing in schizophrenia before the shooting that killed 12, court documents showed Friday.

James Holmes sent a notebook to Lynne Fenton, who teaches at the University of Colorado's medical school and heads student mental services there, that included details and drawings depicting his planned mass killing, according to reports.

It was unclear when the package reached the school, and officials remained tight-lipped due to a gag order imposed by the judge overseeing the case.

But Arapahoe County District Judge William Sylvester unsealed a defense motion to order authorities to hand over the package Holmes sent to Fenton, claiming it was "protected" communication.

The motion also said Holmes's constitutional rights had been violated by the "breach of confidentiality and privilege."

In a preview of likely battles to come, the defense lawyers argued that the contents of the package should not be used as evidence because "Mr Holmes was a psychiatric patient of Dr Fenton, and his communications with her are protected."

Holmes, who was studying neuroscience in a doctoral program at the University of Colorado Denver, is expected to be charged with 12 murders and 58 attempted murders at his next court appearance on Monday, when he is due to be formally charged over the July 20 shooting.

Sylvester granted a hearing on the defense motion also be held on that day.

Fenton's research focuses on schizophrenia and other major mental illnesses.

Prosecutors rebuffed the defense motion and argued that many of the news stories about the package contained significant factual errors and that there was no evidence the government was responsible for the leak.

Reports that the police "are currently examining the contents of the box" are "untrue, as the contents were secured and not examined," prosecutors said.

The alleged gunman gained access to the movie theater in Aurora, Colorado outside Denver via a fire exit shortly after the screening of "The Dark Knight Rises" began and threw two canisters of noxious gas into the auditorium, witnesses said.

After firing one round directly into the air with a pump-action shotgun, he began shooting people at random with a military-style assault rifle capable of firing 50 to 60 rounds a minute.

Authorities say Holmes -- who had dyed his hair a reddish orange -- claimed he was the Joker, Batman's sworn enemy in the comic book series that inspired director Christopher Nolan's film trilogy, which features British-born actor Christian Bale as "the caped crusader."

He gave himself up outside the cinema, still clad in the body armor witnesses described the gunman wearing.

Authorities said Holmes booby-trapped his apartment with the aim of killing anyone who went outside, likely targeting police and first responders. It was days before neighbors were allowed back in the three-story building.

Holmes, 24, is being held in solitary confinement at the Arapahoe County Detention Center and could face the death penalty if convicted, although Colorado has only executed one person since capital punishment was reinstated in 1976.

Photo via AFP