The Willmar, Minn., teenager facing murder charges in a plot to kill his grandmother has a plea deal.

Robert Inocencio Warwick, 18, will plead guilty at a Wednesday hearing to first-degree murder while committing a felony, his attorney Daniel Mohs said Thursday. Another charge — of first-degree, premeditated murder — will be dropped, he said.

A spokesman for the Minnesota attorney general’s office, which has been prosecuting the case, confirmed the tentative agreement. It comes weeks before Warwick’s jury trial was set to start July 21.

The guilty plea could conclude the prosecution of three teens for the July stabbing and strangling of Lila Warwick, 79, that left her handcuffed and bleeding on her basement floor.

Brok Junkermeier, who was 19 when he attacked the church volunteer, pleaded guilty in April — abruptly, in the middle of his trial — to first-degree, premeditated murder and was sentenced to life in prison without the possibility of parole. The youngest teen charged in the case, Devon Jenkins, now 17, pleaded guilty in December to aiding and abetting second-degree murder for acting as the lookout.

While Robert Warwick will face a life sentence, the lesser charge offers him the possibility of parole after 30 years, Mohs said. “He’s out at 47,” he said. “Which is a long time. But it’s better than life.”

The deal also prevents a trial that would have been painful for his family, Mohs added, especially after they endured the graphic evidence and interviews at Junkermeier’s. “I don’t think he wanted to go in there and have to testify.”

Prosecutors say Robert Warwick hatched the plan to rob and murder his grandmother in her rambler on the east edge of Willmar, giving Junkermeier information about her house and habits — including what time she awoke and where she hid a spare key.

During his trial, Junkermeier, who turned 20 this month, testified that he and “Robbie” Warwick, 17 at the time, had been planning the early-morning ambush robbery and attack for months.

Both sides were unsure whether Junkermeier would have testified during Warwick’s trial, Mohs said Thursday. He noted that investigators’ search of Robert Warwick’s phone and iPad had turned up “damaging” evidence.

“I think this is in his best interest,” Mohs said of the plea deal.

During Junkermeier’s trial, prosecutors said Junkermeier had gone to Lila Warwick’s house intending to rob her twice before the morning of her slaying. The first time, Robert Warwick and another teen came with, rifling through the belongings in Lila Warwick’s car.

Robert Warwick’s younger sister, Reanne, testified that her grandmother had been worried about somebody having been in the garage. The glove compartment and car door were left open but nothing was missing.

“Did she mention anybody’s name to ask to see if they had done it?” asked Robert Plesha, assistant attorney general.

“Yes, she thought it would be my brother,” Reanne Warwick said.

In the hours after Junkermeier killed Lila Warwick, he and Robert Warwick went to her home and stole her safe, which they believed would contain more than $30,000, Junkermeier told investigators. Instead, there were savings bonds and documents — including a high school diploma, passport and baptism certificate.

“The bad fact is that he went back after the murder and committed a second burglary by taking his grandmother’s safe,” Mohs said. “That’s been a bad fact from the beginning.”