It was a typical assault rifle case with little defense other than pure ignorance.

Prosecutors charged former Santa Rosa resident Alan MacFarlane with felony possession of a tactical-style weapon after police entered his home during a neighborhood dispute and found banned gun parts scattered about.

MacFarlane, a 60-year-old disabled veteran, was planning to argue he didn’t know the parts were illegal at his upcoming trial. It was an approach that failed at a preliminary hearing, when a judge ruled there was sufficient evidence that he committed the crime.

And then, the unthinkable happened. A Sonoma County sheriff’s deputy with a minor connection to the case shot and killed a 13-year-old boy Oct. 22 while on patrol in Santa Rosa. He apparently mistook a BB gun the eighth-grader was carrying for an AK-47.

The slaying of Andy Lopez made national news. And Dep. Erick Gelhaus became the subject of a criminal investigation — and public debate.

MacFarlane’s lawyer, Steve Spiegelman, spotted an opportunity. He subpoenaed the deputy, a 24-year veteran, alleging he looked at MacFarlane’s gun at the time and sent it to the state crime lab when he couldn’t determine if it was legal.

The thinking was, if Gelhaus didn’t know whether the gun was banned, MacFarlane shouldn’t be expected to.

Spiegelman no doubt sensed other benefits to having a controversial figure like Gelhaus connected to the case. The Lopez family has sued the county in a much publicized wrongful-death claim and protesters have demanded Gelhaus be charged with murder.

But the Sheriff’s Office balked at allowing Gelhaus to testify, arguing in court papers that Spiegelman was trying to distract jurors from the real facts of the case. Besides, Deputy County Counsel Ann Keck said, Gelhaus played no substantial role. He merely looked at a gun another deputy seized and recommended a second opinion.

She accused Spiegelman in court papers of trying to stir up a “media circus.”  

Judge Robert LaForge initially seemed concerned when Gelhaus didn’t appear in court last month to answer the subpoena.

But Monday, the judge ruled against MacFarlane, agreeing with county lawyers that Gelhaus was irrelevant. LaForge pointed out the obvious – that Gelhaus wasn’t mentioned as a witness in the preliminary hearing. It was only after his involvement in the shooting that he was added to the defense witness list.

Also, LaForge accused Spiegelman of twisting the facts. Gelhaus always said the gun was illegal, he said. He only sent it to the Department of Justice lab for confirmation, LaForge said.

Spiegelman seemed to squirm as the judge took time to “correct” him in open court.

“In sum, the court finds that Deputy Gelhaus’ proposed testimony is irrelevant,” LaForge said in a four-page ruling. “To the extent that there might be any relevance at all, the court finds that (it) would be substantially outweighed by substantial risk of undue consumption of time, confusion and misleading the jury in this case.”