Terry Shafer bypassed the jury Thursday morning and accepted a deal that sends him to prison for 40 years for pulling a knife on a sheriff’s deputy.

“It’s what you call signing your life away,” Shafer, chatty and grinning frequently, remarked as he sat next to his lawyer, Tom Watson, at the defense table.

District Judge Ellis approved the deal negotiated between District Attorney Micheal Murray and Watson. Several pending cases against Shafer will be dismissed as part of the deal.

After approving the agreement, Ellis called waiting jurors into the courtroom, told them of the development and dismissed the panel.

The same jurors had convicted Shafer, 53, of aggravated assault on a public servant Wednesday and heard a half-day of punishment testimony.

Testimony was scheduled to resume Thursday morning, and jurors would have heard testimony linking Shafer to the 1992 disappearance of his estranged wife in Harris County, Murray said.

Shafer has not been charged in that case, but Texas Ranger Nick Hanna is assisting in an investigation into Martha Shafer’s disappearance in which Terry Shafer is suspected of killing her, Murray said. He said Hanna would have testified about his investigation.

Martha Shafer’s body has not been found, Murray said.

Shortly before 9 a.m., as court was about to convene, Murray, Watson and Ellis conferred at the bench, and it appeared a deal in Shafer’s sentencing had been reached.

Watson said Shafer wanted to speak with his wife before the sentencing. Ellis said he would allow that but conferred with deputies about security issues, noting that Misty Shafer had been “volatile” during the trial. She had left the courtroom cursing when the guilty verdict was announced Wednesday against her husband.

Deputies brought Misty Shafer into the courtroom, sat her at the defense table across from Terry Shafer and told her to keep her hands on the table.

Only Watson and deputies were allowed to remain with the two.

“Are you happy?” Shafer’s wife, Misty, asked Hanna as she walked past him later in the courtroom. “You won’t be,” she said.

Hanna said nothing in response.

Shafer complimented Murray, telling him he was a good attorney. Shafer also told Ellis, “I just want to say Mr. Watson has done a good job as an attorney.”

“That’s noted. Thank you,” Ellis replied.

On Wednesday, jurors rejected Watson’s argument that his client had been a threat only to himself and was attempting “suicide by cop” when he pulled a knife on deputy Wayne Coffman.

Coffman was attempting to serve an arrest warrant on Shafer on Jan. 5 when Shafer pulled a large kitchen knife from inside his jacket, prompting a standoff that lasted several minutes. Shafer told deputies he wasn’t going to jail and told deputies to shoot him.

Sheriff’s Sgt. Tony Aaron talked Shafer into putting down the knife as deputies trained guns on him.

Jurors deliberated for about an hour before convicting Shafer, then began hearing punishment testimony. Two witnesses testified about a May 2005 incident involving Shafer, and Murray then called psychiatrist Cheryl Hurd to the stand.

Ellis had Hurd initially testify outside the jury’s presence so he could rule on what jurors would be allowed to hear. With jurors gone, Hurd said Shafer had told her “he had actually killed a man and it was ruled self defense, and it wasn’t tried.”

Murray showed Ellis a newspaper clipping from Palestine, Texas, in 1979. The article said Shafer, then 25, had been charged in the shooting death of another man. Murray said he learned that Shafer had been indicted for murder in 1979 but the indictment was dismissed “at the family’s request.”

Murray said other witnesses would testify that Shafer had talked about shooting a man but had actually set the man up, provoking him into shooting at him first and then making a false claim of self defense.

Murray told Ellis that he wanted that testimony before jurors to show bad character, lack of remorse and a braggadocio nature on Shafer’s part.

With jurors still out, Ryan Referda and his wife, Cynthia Flanagan Referda, testified that they had heard Shafer talk about killing a man in self defense.

Ellis ruled, however, that he would not allow jurors to hear testimony about that killing because it was prejudicial. He asked if there were any more matters to hear outside the jury’s presence.

“There is another murder,” Murray replied.

Under Murray’s questioning, Cynthia Referda said she had heard Shafer talk about his “ex-wife” — actually his estranged wife, with a divorce nearly final in Harris County, Murray said later.

Referda said she’d heard Shafer say “she’d never be found” and she was “under water, cement,” Referda said. “He just said she’d never be found. … He talked about alligators. … He just said she was hid in water in cement,” Referda said.

Murray asked her if she had told Hanna that Shafer had talked about killing his ex-wife and hiding the body. Referda said Shafer had never said he’d killer her or how she was killed.

She said Shafer would laugh and say a detective who was investigating Martha Shafer’s disappearance “would never find her.”

Murray said Hanna would be among witnesses to testify about Terry Shafer’s suspected involvement with Martha Shafer’s death. Ellis ruled that he would allow jurors to hear testimony related to Martha Shafer’s — but jurors never got the chance, since jurors’ involvement ended without that testimony being elicited.

After the trial, Murray said Shafer is suspected of abducting Martha Shafer before she arrived at work one morning, killing her and putting her body in a septic tank.