James Holmes told a classmate he wanted to kill people.

The man accused of shooting 12 people dead in a Colorado cinema may have told a classmate that he wanted to kill months before the attack.

Newly released court documents claim that James Holmes, who is alleged to have opened fire during a midnight screening of The Dark Knight Rises in Aurora on 20 July, had revealed his compulsions four months earlier.

Prosecutors made the allegation in a motion released while seeking access to Holmes's records from the University of Colorado Denver's neuroscience graduate programme.

State attorneys claimed Holmes "had conversations with a classmate about wanting to kill people in March 2012 and that he would do so when his life was over", Associated Press said.

The conversation would have occured during the same period that police claim Holmes began receiving a "high volume of deliveries" at his home and the university itself.

While officers have not revealed what was in the packages, Holmes did buy thousands of rounds of ammunition online. He had several guns and had booby-trapped his home with explosives before the cinema assault.

Prosecutors alleged that Holmes made unspecified threats against a professor at the university in June, before failing his end-of-year final exam. The prosecutors added that professors had urged Holmes to "find another line of business".

The defence team for Holmes maintained that prosecutors should not be able to access his student records. The team claimed that Holmes is mentally ill and was seeing a psychiatrist at the university.