A Eureka man will spend 27 years to life in prison for murdering a Blue Lake man in April 2015, then attempting to murder officers who tracked him down nine months later.

This morning Nicholas Ryan Joseph Johnson pleaded guilty to killing 36-year-old David Dwayne Ganfield, who was bludgeoned to death as he slept in his Blue Lake home. Johnson also admitted trying to kill two district attorney’s investigators by opening fire with a semiautomatic rifle.

He has been in jail since February 2016 on the murder charge. The case involving the local investigators was filed just last week by the state Attorney General’s Office.

“The defendant fired his semiautomatic weapon at two district attorney’s investigators who were trying to effectuate his arrest,” Deputy Attorney General Geoff Lauter said over speaker phone in Judge John Feeney’s court. Lauter said Johnson fired eight rounds at the officers, but they were eventually able to “subdue him and effectuate the arrest.”

Johnson was subdued when the investigators returned fire, hitting him multiple times. He spent some time in a hospital before being lodged in Humboldt County Correctional Facility.

His plea deal includes a sentence of seven years for attempted murder and 20 years for personal discharge of a firearm. He pleaded to second-degree murder in Ganfield’s death and will serve a concurrent sentence of 16 years to life. Defense attorney Neal Sanders said Johnson will be eligible for parole after serving the 27 years.

Last year a jury convicted Johnson’s co-defendant Jonas Randall Semore of second-degree murder. Semore is serving a term of 15 years to life.

An older couple, Ganfield’s relatives, were in the courtroom audience this morning. And several people there to support Johnson, 27. One woman was smiling and otherwise silently communicating with him, and the bailiff walked over to caution her about communication with prisoners. When the bailiff turned his back to return to his post, Johnson lifted his right hand and extended the middle finger.

Asked whether he was willing to give up his right to appeal, Johnson refused. Then, quite the courtroom comedian, he addressed the judge.

“There’s no way to get probation on this?” Johnson asked, grinning. Feeney didn’t answer.

Regarding his sentencing, Johnson asked the judge to “put it back as far as possible.” Defense attorney Sanders requested a date in late October, and Deputy District Attorney Roger Rees objected.

Rees said the sentencing should be “sooner rather than later” because Humboldt County Correctional Facility is not set up to house prison inmates. The prosecutor asked for a brief recess, then returned to inform the judge that Johnson, within the past week, tackled another jail inmate. He again asked for a speedy sentencing.

“My client has been in custody for over two years,” Sanders responded. “He hasn’t changed as a person because of today.”

Feeney compromised by scheduling the sentencing for Oct. 19.

As part of the plea deal some less-serious charges were dismissed, including an allegation that Johnson possessed drugs in jail.