HOUSTON - Shannon Miles has pleaded guilty for the murder of Deputy Darren Goforth.

Miles will serve life in prison without the possibility of parole. The guilty plea was part of a plea deal that the prosecution, defense, sheriff, and Deputy Goforth’s family say they’re happy with.

It's a sentence the prosecution says is still harsh and just, while also sparing the Goforth family from a trial and allowing them to move forward.

Miles pleaded guilty to repeatedly shooting and killing Deputy Goforth at a northwest Harris County gas station in August 2015.

Wednesday's hearing lasted just seven minutes. After Miles pleaded guilty, his attorney told the judge he’s confident his client is competent. He said he and others on the defense have had several conversations with him since Miles’ was sent to a state mental hospital.

This plea marks the end of an emotional two years for the families of everyone involved in this case, especially Deputy Goforth’s widow, Kathleen. She spoke publicly for the first time after the hearing.

"He loved our kids. I'm so grateful for the memories they have of him and I hope to always honor that, as that is what they need. And it's what Darren deserves," Kathleen Goforth said.

Watch: Widow says plea deal is 'right thing to do'

Related: Community keeps Deputy Goforth's memory alive

Prosecutors say Miles’ longtime mental illness weighed heavily on both their team and Goforth’s widow. They also said getting their chances of getting a death penalty conviction on someone with severe mental illness was “almost zero”.

“I can kill a drug-induced crazy guy, and frankly, that’s what I thought I was getting when I started. It’s different when you have a true mental deficiency, and Kathleen is such an amazing person. It weighed heavily on her, it weighed heavily on all of us. It played a large part but not the only part," said Special Prosecutor Brett Ligon.

Prosecutors say with this plea deal, this is the end of this case. There’s no chance Miles can appeal.

Photos: Dramatic scenes outside Goforth memorial

Miles’ motive is still a mystery in this case.

"Due to the severity of his mental illness, he is episodal psychotic, he has no memory of the day, that day of his life even," said Anthony Osso, Miles' defense attorney.

Raw video: News conference on Shannon Miles to serve life without parole for murder of Deputy Goforth