PORTLAND — A jury heard opening arguments this afternoon in the murder trial of William Hanaman.

Hanaman, 52, is accused of killing his ex-girlfriend, Marion Shea, at his apartment on Ocean Avenue on Nov. 10, 2009.

Police say Hanaman stabbed the 47-year-old mother of five, then tried to kill himself by overdosing on prescription medications. Acting on a phone call from Hanaman’s sister, police entered the apartment and found the pair lying on a bedroom floor. Hanaman was rushed to the hospital for treatment; Shea was already dead.

Hanaman had been charged with domestic violence assault against Shea about a month before the killing, and he was ordered not to have any contact with her.

Hanaman’s lawyer Robert Levine said his client acted in self-defense.

“He’s going to testify and he’s going to tell you what happened,” Levine said during his opening statement.

Levine said Shea was the physical aggressor in the relationship, and she assaulted Hanaman three times in the fall of 2009. All of those confrontations happened when Hanaman confronted Shea over her use of prescription medications, including Oxycontin and Valium, Levine said. The third confrontation happened the night of Nov. 11, he said. Hanaman claims Shea came at him with a knife, and that he grabbed the weapon and stabbed her to death.

“She died because of an instant reaction by him to a moment of provocation,” Levine told the jury. He said forensic evidence showed Shea had handled the knife.

“That’s how you’ll know that Bill Hanaman is telling the truth,” Levine said.

The prosecutor, Assistant Attorney General Leane Zainea, said the self-defense claim doesn’t pass the common sense test.

Zainea said Shea died from multiple stab wounds to her chest, abdomen, arm, buttocks and the back of her legs. The cuts showed that Shea was trying to defend herself and get away from Hanaman, Zainea said.

“Marion Shea did not deserve to die,” Zainea said.

After the stabbing, Hanaman put bloody clothing in a closet, put the knife in the kitchen sink, and packed up some personal momentos in a box and took them to his sister’s house, Zainea said. Then Hanaman returned to his apartment, wrote a suicide note and overdosed on prescription medications.

“It was a relationship filled with drinking and drug use,” Zainea said. “It became toxic and dysfunctional until it became violent.”