Gunman Robert Stewart shot and killed eight at a nursing home in Carthage, NC, in March 2009.

A man who went on a shooting rampage at a North Carolina nursing home that killed eight people was convicted of second-degree murder and has been sentenced to life in prison.

A jury found Robert Stewart guilty on eight counts of second-degree murder on Saturday. A judge then imposed the maximum sentence for each of the counts for a total of 142 years. The state had sought first-degree murder convictions, which would have made Stewart eligible for the death penalty.  Stewart’s lawyers said they plan to appeal.

There was no dispute during the trial that Stewart shot seven residents and one nurse at Pinelake Health & Rehabilitation Center on March 29, 2009. However, Stewart’s lawyers argued he was mentally ill and had been taking four to 12 times a prescribed amount of Ambien for years before the shootings.

However, prosecutors successfully argued that Stewart was despondent over his wife leaving him and had planned the shootings at the place where she worked in retaliation. His wife, Wanda Neal, was not harmed but residents Bessie Hendricks, 78; John Goldston, 78; Tessie Garner, 88; Jessie Musser, 88; Lillian Dunn, 89; Margaret Johnson, 89; Louise Decker, 98; and nurse Jerry Avant, 39, were killed. Stewart was stopped when a Carthage police Cpl. Justin Garner shot him in the shoulder.