Miranda Kerr's alleged stalker has faced court, and the judge left him "wide-eyed".

Australian man Shaun Haywood has claimed he was insane when he went to supermodel Miranda Kerr’s Malibu home and became involved in a violent tussle with a security guard where a gun was fired.

Haywood, a former boxer who has remained locked up in California jails and prison hospitals since his arrest in Malibu almost two years ago, entered not guilty pleas by reason of insanity to attempted murder and other charges in a Los Angeles courtroom on Wednesday.

Haywood, 31, formerly of the NSW Central Coast, was dressed in a baggy gold prison jumpsuit and had his wrists shackled behind his back during the court appearance.

He appeared surprised when Judge Susan Speer told him if found guilty, despite his claim of being insane, he could spend the rest of his life locked up in the California state hospital system.

“Still?” a wide-eyed Haywood replied.

Haywood’s lawyer, Ralf Jacobsen, briefly spoke to him.

Judge Speer then asked Haywood if he still wanted to enter the not guilty by reason of insanity pleas for charges of attempted wilful, deliberate and premeditated murder; aggravated mayhem; and assault with a deadly weapon, a knife.

“Is that what you want to do?” the judge asked.

“Yes,” Haywood replied.

Earlier this month in the same court Judge Speer found Haywood mentally fit to stand trial after multiple delays while psychiatrists assessed him.

Haywood has been in custody in California and his future uncertain since his arrest on October 14, 2016, outside of the Malibu home Kerr shared with her young son Flynn.

Video via The Today Show

Kerr and Flynn were not home at the time of the incident.

Haywood went to the house to deliver the supermodel a letter and when he was confronted by a security guard a tussle broke out, authorities alleged.

Hayward is accused of grabbing the security guard’s knife and slashing the guard in the face.

The guard responded by shooting Hayward, according to authorities.

Kerr, who has since married Snapchat billionaire Evan Spiegel, no longer lives at the house.

Haywood remains in custody.

Want to help Mamamia with some new ideas? Plus go in the chance to win $50? Take our quick survey now. (ALL POSTS FROM 25/09 (SOME)-