Robin Pask, 34, had admitted manslaughter on the grounds of diminished responsibility.
He killed Elizabeth Howe, 34, a mother-of-two, while attending an Open University course at York University, Leeds Crown Court heard.
Prosecutor Stephen Williamson QC said the married father-of-three slashed Oxford graduate Mrs Howe's throat with a knife in campus accommodation and then dressed in her clothes.
Pask, from Horwich, Bolton, Lancashire, had driven to York to take part in a week-long Open University course where Mrs Howe, who he did not know, was a lecturer.
He entered her room, bolted the door behind him and attacked Mrs Howe with a Kitchen Devil knife.
Mr Williamson said Pask tore her dress from her body, stripped her naked and sexually assaulted her.
He slashed her throat and after she was dead made a 20-inch cut from her chest to her groin and also cut her back.
He then discarded his own clothes, which were covered in blood and put on her clothes which he found in her room.
Dressed as a woman, Pask wandered round the grounds for some hours until he was arrested by police at 1.55am the next morning.
Mr Williamson said Pask had been excited about the course and had packed his briefcase with pornographic magazines and some of his wife's slimming tablets.
He had been drinking vodka and strong wine before committing the killing.
Martin Bethel QC, defending, told the court that Pask had faced trial for the murder of Mrs Howe but had collapsed during the hearing and was found to be unfit for the case to continue.
Psychological reports found that he was suffering from psychotic disorders.
The judge, Mrs Justice Smith, ordered that Pask be detained without time limit at Ashworth psychiatric hospital on Merseyside.Reuse content