Image caption After James Holmes' initial appearance, cameras have been banned inside the court

The suspect in the Aurora cinema shootings had made threats and was banned from his university campus after failing an exam, US prosecutors say.

The accusations came in a hearing over whether prosecutors will be able to see records kept by the University of Colorado, where James Holmes studied.

The university said his access to parts of the campus had been revoked as he was no longer enrolled in classes.

Mr Holmes, 24, is accused of killing 12 and wounding 58 in the gun massacre.

Prosecutor Karen Pearson said Mr Holmes had failed oral board exams in early June and one of his professors had suggested he may not have been suitable for the PhD course.

Mr Holmes then started making threats that were reported to police and he was barred from University of Colorado facilities before the shooting, she added.

Ms Pearson did not elaborate on the nature of the threats or disclose where the information came from.

A university spokeswoman told the Associated Press that Mr Holmes was not banned but that his access to restricted areas of the campus was revoked after he left his graduate course.

Mr Holmes had been in the process of withdrawing from the school's neuroscience programme at the time of the massacre.

University spokeswoman Jacque Montgomery also confirmed that a criminal background check was done on Mr Holmes before the 20 July attack, but did not provide further details.

Defence lawyers accused prosecutors of going on a "fishing expedition" for the records.

Colorado prosecutors said they are seeking 100 pages of non-medical university records, in order to gain access to a notebook with descriptions of a violent attack Mr Holmes allegedly sent to university psychiatrist Dr Lynne Fenton.

Previous reports have said that Dr Fenton told a campus threat assessment team and campus police she was concerned about Mr Holmes.

The academic records have already been turned over to Judge William Sylvester.

Defence lawyers are seeking to suppress the documents from being examined, even by the judge, but their legal reasoning was sealed under a gag order that has limited public information about the case.

Judge Sylvester said he would rule in time for the next scheduled hearing on 30 August.