Jeffrey Ferguson, the Orange County judge who allegedly texted a confession to court staffers after killing his wife in front of their son, made a mumbling drunken confession to responding Anaheim police officers captured on bodycam video and asked them to shoot him, according to court filings.

The son who allegedly witnessed the shooting told investigators his parents had been fighting for most of the evening and that his father was drinking heavily.

"The shooting stemmed from an argument that began earlier that same evening," prosecutors wrote in a bail motion. "While arguing at dinner (at a restaurant nearby their residence), Defendant pointed his finger at his wife…in a manner mimicking a firearm."

The arguing continued at home, and Sheryl Ferguson told her husband, "Why don't you point a real gun at me?" prosecutors alleged.

CA JUDGE PLEADS NOT GUILTY TO KILLING SPOUSE AFTER ALLEGEDLY TEXTING COURT STAFF ‘I JUST SHOT MY WIFE’

Victim Sheryl Ferguson smiles in undated photo, with dark hair, brown eyes and makeup on

This undated photo provided by Larry Rosen shows homicide victim Sheryl Ferguson. A Southern California judge charged with killing Ferguson, his wife, during an argument while he was drunk has pleaded not guilty. His lawyer says it was an "accidental shooting." Los Angeles Superior Court Judge Ricardo Ocampo, on Tuesday, Aug. 15, 2023, ordered Orange County Superior Court Judge Jeffrey Ferguson to surrender his passport, submit to searches, and wear monitoring devices as part of new bail conditions sought by prosecutors.  (Larry Rosen via AP)

That's when Ferguson is accused of pulling a .40-caliber Glock pistol out of an ankle holster and firing a single shot through his wife's chest.

"He shot her at close range," Deputy District Attorney Chris Alex wrote in a bail motion. "He did so while intoxicated. His adult son witnessed the homicide."

Their son called 911 and attempted CPR, but she died from her injuries.

"Shortly after Son's 911 call, Defendant himself called 911 to report (vaguely) that his wife had been shot," prosecutors wrote. "When asked whether he shot his wife, Defendant responded that he did not want to talk about it now."

Orange County Superior Court Judge Jeffrey Ferguson frowns in court during bail hearing in wife's murder

Orange County Superior Court Judge Jeffrey Ferguson sits during a hearing at the Clara Shortridge Foltz Criminal Justice Center, Tuesday, Aug. 15, 2023, in Los Angeles. Judge Ferguson, charged with killing his wife during an argument while he was drunk, pleaded not guilty Tuesday, and his lawyer says it was an "accidental shooting."  (AP Photo/Damian Dovarganes, Pool)

However, according to the filing, when responding officers arrived, he had more to say, in slurred words and reeking of alcohol.

First he asked them to shoot him. Then he offered "several spontaneous statements."

"What the f--- did I…well I guess I'm gone for a while," he allegedly told officers in part of the exchange. "Oh my God…my son…f--- me…what an a--hole I am."

Graphic Language Warning: Read the filing (Mobile users go here)

CALIFORNIA JUDGE ARRESTED, CHARGED WITH WIFE'S MURDER AFTER FATAL SHOOTING

Anaheim police recovered a single spent casing in front of Sheryl Ferguson's body and the projectile from a wall behind her. They also seized 47 legally owned guns – rifles, shotguns and handguns – at Ferguson's house and more than 26,000 rounds of ammunition.

Defense counsels recovered another rifle, prosecutors said, and one last .22-caliber rifle is unaccounted for.

Sometime after the shooting, Ferguson also allegedly confessed via text message to his bailiff and court clerk, according to prosecutors.

Mugshot of Judge Jeffrey Ferguson

Orange County Superior Court Judge Jeffrey Ferguson, 72, has been arrested by Anaheim police in connection to the fatal shooting of his wife at their home.  (Anaheim Police Department)

"I just lost it," he wrote, according to authorities. "I just shot my wife. I won’t be in tomorrow. I will be in custody. I’m so sorry."

Both of them thought it was a joke, prosecutors said.

Ferguson was an Orange County Superior Court judge since 2015, and before that, served as a deputy district attorney for more than 30 years.

CLICK HERE TO GET THE FOX NEWS APP

"He faces (and, by virtue of his employment, is fully aware he faces) the realistic prospect that he will die in prison if convicted," Deputy District Attorney Chris Alex wrote in the bail motion.

Ferguson has pleaded not guilty and was freed earlier this week on $1 million bail on murder and firearms charges. Under the terms of his release, he is banned from airports and bars, must surrender his passport and refrain from drinking, among other restrictions.

He's due back in court for a preliminary hearing on Oct. 30.