Updated

Robert Stewart walked the halls of a North Carolina nursing home, his lawyer said Monday, firing blasts from a shotgun seemingly at random, stopping to grab shells from a shoulder bag every time he needed to reload. When it was over, eight people — mostly elderly residents — were dead, and three wounded.

But whether the 47-year-old painter and National Guard veteran was fully responsible for his actions will be the main question in Stewart's trial, which began Monday in Carthage. With an eye toward keeping him off death row, his lawyers are arguing that a series of personal calamities and a cocktail of prescription medication put Stewart in a mental state in which he hardly knew where he was that day in March 2009.

"What happened on March 29 was absolutely horrifying and bloodcurdling, and there's nothing I can do about that," Jonathan Megerian, one of Stewart's lawyers, told the jury.

However, he said, "it was done by someone who didn't understand what he was doing."

In an opening statement by prosecutors, though, Tiffany Bartholomew portrayed Stewart as a man in control, able to pick out his ex-wife's car in the parking lot of Pinelake Health and Rehabilitation Center and empty two magazines of ammunition from a .22-caliber rifle into the vehicle before making his way into the nursing home. Although the staff tried to lock down the facility, Bartholomew said, they were unable to stop Stewart from walking the halls until he came to the locked ward where his ex-wife worked.

"Nothing that they did that day would be able to stop the defendant, because he was a man on a mission," she said.

Unable to get into the ward where his ex-wife worked, Stewart was confronted by Carthage police officer Justin Garner, who shot and wounded the man and was in turn shot and injured by Stewart. Handcuffed on the floor of the nursing home, Stewart begged the police officer to finish him off. Seven residents of the nursing home, one as old as 98, were dead, along with the nurse who had made the lockdown announcement.

"This was not a random act," Bartholomew told the jurors. "The defendant went to Pinelake with a specific reason and a particular purpose."

Acknowledging that many of Bartholomew's descriptions of facts at the scene were accurate, Megerian described a man who was on the verge of mental collapse in the weeks before the rampage. His wife had left him, taking his stepdaughter with her. A barn on his property that contained cherished family heirlooms burned down. Stewart, unable to sleep regularly for at least two years, was taking the prescription sleep aid Ambien in doses about 12 times the recommended limit.

On the Friday before the shootings, Stewart visited his doctor and complained about depression, saying he was worried he would hurt himself or others, Megerian said. He was prescribed two antidepressants that can include side effects ranging from suicidal behavior to unpredictable mood swings. Combined with the sleeping pills and his depression, the medication essentially made Stewart a lethal sleepwalker, Megerian said.

"Robert Stewart does not remember what happened on March 29, 2009, and he has never been able to tell anyone about it," Megerian said.

Because of widespread publicity, the jury was picked in Stanly County, about an hour west of Carthage. Jury selection took two weeks, and Judge James Webb has said the trial might take between four and six weeks.

During Monday's session, at least two-dozen relatives of the victims sat in a roped-off section in the courtroom, some of them staring directly at Stewart, others tearing up during portions of witness testimony and opening statements. Stewart, clad in a white dress shirt and dark blazer, said nothing, occasionally putting on a pair of reading glasses to study documents on the table in front of him.

The first witness in the case was one of the people injured in the shooting, Michael Cotton, who had arrived at Pinelake that morning to visit his great aunt. Cotton, a retired prison superintendent, was shot in the shoulder as he pulled into the parking lot. Jumping out of his truck, he ran into the building, bleeding, to warn the staff. Cotton hid in a bathroom and called 911 as he heard more shooting.

"I didn't know how bad I was hit, so I just decided to go in and try to alert the people," Cotton said. "When I told them there was a man with a gun coming in, they kind of looked at me like, 'This guy's crazy.'"