TAMPA — Before Matthew Buendia was accused of trying to kill a Hillsborough sheriff's deputy, he was irritable, sleep-deprived, had trouble remembering and was prone to fits of rage.Those traits are hallmarks of post-traumatic stress disorder, a condition that afflicted Buendia after his time in combat with the Marine Corps in Iraq and Afghanistan.The jury in Buendia's attempted murder trial heard Monday that the condition may have caused him to lose touch with reality the night of Sept. 30, 2011.That night, according to prosecutors, Buendia shot Hillsborough sheriff's Deputy Lyonelle De Veaux three times after she arrived at his apartment complex to investigate a report of domestic violence.De Veaux testified last week. The state has rested its case. Ernest Boswell, a forensic psychologist, testified Monday for Buendia's defense, detailing the 28-year-old's experiences in combat and subsequent history of mental illness.In Afghanistan especially, Buendia saw fellow Marines killed and endured constant threats to his own life. When he came home, he struggled to adapt to civilian life.Once, he left his seat while attending a football game with a friend. Minutes later, he called the friend's cellphone and said he didn't know where he was and couldn't find his way back.While working in an office job, he began swearing and slamming down boxes when he was told to move to another cubicle. He draped an American flag over a computer keyboard. The incident happened the same day that a friend of Buendia's was redeployed to Afghanistan.Months before the shooting, a car crashed through Buendia's apartment while he was taking a nap on a couch. Waking amid crumbling sheetrock, he believed he was back in combat. The investigating deputy was De Veaux.Buendia had sought help from the U.S. Department of Veterans Affairs, where doctors prescribed a wide variety of pills. At one point, Buendia was taking 17 medications per day.He developed a drinking problem. He smoked marijuana to increase his appetite and help him relax.The night of the shooting, Buendia "was in a state of hypervigilance," Boswell testified. "Irritable, paranoid."The psychologist told the jury: "Matthew Buendia unequivocally has PTSD,"Buendia is charged with attempted murder of a law enforcement officer and other felonies. If convicted, he faces up to life in prison.Contact Dan Sullivan at [email protected] or (813) 226-3386. Follow @TimesDan.