A petrified Sandra Bullock made a desperate 911 call from inside a cupboard after a stalker broke into her mansion with a love letter.

The Hollywood actress had to flee into a closet with a “safe door” after Joshua Corbett, 39, broke in on 8 June last year.

Evidence showed that the stalker had an arsenal of illegal assault weapons at his home but was not armed at the time on Bullock’s property, Los Angeles Superior Court judge Terry Bork ruled.

Bullock told emergency call handlers, as heard during a recording played in court: “I’m in my closet. I have a safe door. I’m locked in the closet right now.” Her five-year-old son was not at home at the time.

Bullock gave the police directions to her bedroom over the phone. She thanked the dispatcher when officers had arrived and is said to have sounded like she was crying.

Corbett was clutching a black notebook when he was arrested with a two-page love letter and magazine clippings of Bullock, 50. The images of her in revealing clothing supported an inference that there was a sexual motivation to his pursuit of the actress.

The judge read out a note in the notebook which said: “You are so hot and intelligent and lithesome and taut.”

A defence lawyer argued that Corbett should have his stalking and burglary charges quashed as he was suffering from a delusion that he was married to Bullock and claimed he was not wanting to hurt her.

“The love letter that Corbett carried with him professed nothing but love and admiration,” Paul Takakjian said. “There is nothing in there about harming her. The people are trying to make more of the case than there is.”

Corbett appeared at Ms Bullock’s house three nights in a row and had broken into the home in the middle of the night, deputy district attorney Wendy Segall said.

“It’s clear that he was stalking her repeatedly and maliciously,” she said. “There is not a more clear-cut case of stalking than this one.”

Corbett also is charged with having assault weapons, tracer ammunition and machine guns that were found when authorities searched his home. He has pleaded not guilty to all charges.