SANTA ANA – The son of a former “Real Housewives of Orange County” star is seeking to have a judge dismiss attempted-murder charges against him because police recorded his jailhouse phone calls while he was legally representing himself – a move that violated his constitutional rights, his lawyer said.

Joshua Waring, the troubled son of former reality TV personality Lauri Peterson, is facing three counts of attempted murder for allegedly shooting and wounding a man in Costa Mesa before leading police on a chase in June 2016.

Prosecutors said they filed the two additional attempted-murder charges because a man and a woman were standing nearby when Waring allegedly fired the gun.

Waring, 28, was set to face trial in Orange County Superior Court this week, but in a document filed on Monday he alleges his right to a fair trial was violated when law enforcement monitored and recorded his telephone calls from jail while he was acting as his own lawyer.

Tustin defense lawyer Joel Garson, who is now representing Waring, said a 41-page report shows that a Costa Mesa police investigator monitored and recorded Waring’s telephone calls in jail from at least June 2016 through February 2017.

Waring was “pro per,” meaning he was representing himself, during much of that period and calls pertaining to his defense strategy were recorded and turned over to prosecutors in the case, Garson said in court documents.

Garson said the report on the recordings, which the District Attorney’s Office gave him, was “somehow lost” until it surfaced on Friday, just days before the trial.

“Particularly egregious is the fact (that Waring) was being recorded on the days he was engaged in his pro per preliminary hearing, one that (the investigator in court) sat at counsel table as the case agent,” Garson wrote.

Garson on Tuesday said the recording is a serious violation and warrants a dismissal of all charges. A judge is set to consider the issue on Feb. 13.

“I don’t see any remedy other than dismissal,” Garson said.

A representative of Costa Mesa police referred comment to the Orange County District Attorney’s Office.

Michelle Van Der Linden, a spokeswoman for the DA’s Office, said prosecutors are reviewing the facts and case law and “will respond accordingly at the next scheduled hearing.”

Before the most recent incidents, Waring, a San Juan Capistrano resident, had more than a dozen mostly drug-related misdemeanor and felony charges.

His mother was one of the original “Real Housewives of Orange County” but left the TV show after three seasons as her son battled drug and legal problems.

In November, he was charged with a felony for allegedly having an alcoholic beverage called “pruno” in jail, according to court records. In July, he was again charged with felony possession of an alcoholic beverage in jail, and also a misdemeanor for allegedly being under the influence of a stimulant.

He is now facing multiple felonies and misdemeanors for allegedly shooting a 35-year-old man in the lower torso on the 2900 block of Babb Street in Costa Mesa and then fleeing in a BMW. Prosecutors said he led police on a chase, at one point getting into a traffic accident, and then ran before surrendering in a Santa Ana store.