Jason Alexander has been sentenced to 128 days in jail.

On Friday, Us Weekly reported that Britney Spears’ ex was found guilty of aggravated trespassing and battery after he crashed the pop star’s wedding to Sam Asghari in June.

READ MORE: Britney Spears Granted Emergency Restraining Order Against Ex Jason Alexander

Alexander, 40, had gained entry to Spears’ home, getting only feet from her while she was in her bedroom. Armed with a knife, he was subdued by two security guards and subsequently arrested.

He had initially pleaded not guilty to three misdemeanour charges, including the trespassing and battery, along with vandalism, and one count of felony stalking.

Before the judge’s ruling, Alexander changed his plea to no contest, with the vandalism and stalking charges being dismissed.

The judge ordered that he serve his 128-day sentence in Ventura County Jail, and a “no contact” protective order against him was granted to both Spears and one of her security guards.

He has already served 64 days since his arrest, and will not serve the full balance of the sentence.

READ MORE: Britney Spears’ Ex-Husband Jason Alexander Arrested After Crashing Wedding To Sam Asghari

Spears and Alexander made headlines in 2004 when they tied the knot in Las Vegas; they annulled their marriage after just 55 hours.

“Britney Spears invited me here,” Alexander said in an Instagram Live video before entering her home in June. “She’s my first wife. My only wife. I’m her first husband. I’m here to crash the wedding cause nobody [is] here but Sam. So where the f–k’s the family?”

There will also be a hearing in November to determine whether Alexander is allowed to possess weapons and firearms.