The suspect in the deadly Colorado cinema attack threatened a professor and was banned from his university campus before one of the worst mass shootings in US history, prosecutors say.

Newly released court documents gave an important look at a case whose details have been kept largely out of public view.

James Holmes faces 152 charges over the July shooting at a midnight premiere of the latest Batman film that killed 12 people and injured 5. His lawyers argue he is mentally ill.

The documents say the threat is why the University of Colorado revoked Holmes' access to campus. The name of the professor has been blacked out.

Prosecutors say the professor reported the threats to the university, and Holmes was denied access to campus "as a result of these actions".

In other documents, defence lawyers say the prosecutors' allegations are false, based on university statements. The university has said Holmes was denied access to non-public parts of the campus because he had withdrawn from school.

Defence lawyers say Holmes sought the help of a university psychiatrist before the shooting, raising the possibility that Holmes will plead not guilty by reason of insanity.

In court, prosecutors raised the prospect that Holmes was angry at the failure of a once-promising academic career and stockpiled weapons, ammunition, tear gas grenades and body armour as his research deteriorated and professors urged him to get into another profession.

After the shooting, Holmes' apartment was found rigged with explosives.

Chief Deputy District Attorney Karen Pearson said Holmes failed a key oral exam in June, was banned from campus and began to voluntarily withdraw from the school.

Court documents have confirmed that Holmes sent a package to university psychiatrist Lynne Fenton. Defence lawyers describe Ms Fenton as Holmes' psychiatrist, although prosecutors have said their doctor-patient relationship ended on June 11, weeks before the attack.

Court documents also confirm information from prosecutors that Holmes in March spoke with another student about killing people "when his life was over".

Prosecutors and defence lawyers had asked that court documents be sealed to preserve an ongoing investigation and protect Holmes' right to a fair trial.

The judge's order noted that some information contained in court documents had been divulged in court and that placing limits on what is released balances the public's First Amendment rights to see the court file with prosecutors' and defence lawyers' concerns.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.