MARTINEZ — A retired Hercules police officer who was convicted of attempting to murder his estranged wife was sentenced to 28 years in prison Friday.

John Goodner was convicted earlier this year of shooting up his estranged wife’s home early one morning in 2015, and of stalking her for months leading up to the shooting. With good behavior, he’ll be eligible for release after serving 85 percent of his sentence.

Goodner was facing a maximum of 30 years and a minimum of 25. Before issuing the sentence, Judge John W. Kennedy denied a defense motion for a new trial.

“I am pleased because this sentence re-enforces the position that no one is above the law,” prosecutor Chris Sansoe said after the verdict.

Goodner had been harassing and stalking his wife — including by surreptitiously placing a homemade tracking device on her car — for months when she decided to get a restraining order. He responded by telling her, “I’ll kill you first,” according to her testimony.

For breaking news get our mobile app for free from the Apple app store or the Google Play store.

Days later, as the woman slept in her Antioch home, Goodner drove by in a pickup and fired several shots into the wall of her bedroom. The shooting was captured on video. Police arrived at Goodner’s home minutes later, and noticed the hood of his truck was warm. He refused to come out but surrendered after a brief standoff.

Sansoe said the victim is looking forward to putting the incident behind her and moving on with her life.

Dirk Manoukian, Goodner’s defense attorney, called the result of the case “disappointing” and said his client would appeal the conviction.

“While a lot of his conduct was inexcusable, I do not believe the evidence supported that he ever had an intent to kill or harm her,” Manoukian said. “That’s the part that’s most troubling; I think when you take the emotion out of it, I think when you take the fact that he’s a former police officer out of it and look at it objectively, I do not believe the evidence supports the conclusion that the only possible intent he had was to kill.”

But Sansoe disagreed, pointing out Goodner was a trained shot and said as a former officer, he knew what he was doing was a serious crime.

“The jury heard that one of those bullets went through the bedroom window and within inches of the victim as she slept,” Sansoe said. “The evidence showed that he had extensive training with firearms.”