TMZ Composite
Exclusive Details

Britney Spears Ex Tried to Get into Her Bedroom ... Security Guard Testifies

Britney Spears nearly came face-to-face with her ex-husband when he attempted to crash her wedding and got inside her home ... so says one of her fired security guards.

Jason Alexander is in court Monday for a preliminary hearing, and witnesses are testifying about what went down the day Britney was getting married to Sam Asghari ... and some of the testimony is terrifying.

One of Britney's security guards -- who's since been fired over the incident -- told the judge Alexander beelined it straight for Britney's bedroom after sneaking onto the property and getting inside the main house. The guard testified, Alexander tried opening Britney's bedroom door while she was inside, but it was locked.

What's more, the guard said Alexander kept repeating that he needed to talk to Britney and was looking for her, even though he was not on the guest list.

TMZ broke the story ... Alexander, who cops say was armed with a knife, live streamed himself getting onto Britney's property and up to the second level of her home, demanding to see her on her wedding day. Police arrested him before he was able to make contact with Britney.

The security guard, who got fired by Britney shortly after the incident, also testified Alexander had been spotted on the outskirts of the property multiple times leading up to the wedding ... including the day before, despite being told to stay away.

Alexander pleaded not guilty to the charges against him ... including felony stalking, plus vandalism, and trespassing battery.

TMZ.com

Another witness, a detective with the Ventura County Sheriff, also testified Britney told her longtime agent, Cade Hudson, that Alexander was "scary."

Britney got a 3-year restraining order against Alexander after the wedding fiasco, and her attorney, Mathew Rosengart, says he's doing everything in his power to make sure she's protected.

Alexander's bail remains at $100,000 and his next court date is set for July 12.

Click here for info about our online advertising practices.