AUGUSTA – Kenneth McDonald, on trial for the killing of his mother last year, abruptly pleaded guilty to murder Wednesday in Kennebec County Superior Court.

Justice Michaela Murphy accepted his plea and continued the case 30 days for sentencing. Under his plea agreement with the state, McDonald will receive a sentence of 25 years — the minimum for murder under Maine law — to 40 years in prison.

McDonald, 44, killed Janice McDonald, 80, on Aug. 24, 2009, in their home in Monmouth. The vicious attack on Janice McDonald was described in detail during two days of graphic testimony.

McDonald had pleaded not guilty to the murder charge. His attorney, James Billings, told jurors in his opening statement that McDonald did, in fact, kill his mother but should be found guilty of manslaughter instead of murder.

Billings said the stabbing was an act of rage, brought on by an argument after the woman refused to give her son permission to go to the coast.

Billings said the mother controlled every aspect of McDonald’s life, including whether he could take money from his savings account.

McDonald, who was characterized in court by family members and co-workers as “slow,” worked part time at the Monmouth Transfer Station.

Neither he nor his mother drove, so they depended on relatives, friends and neighbors for rides.

On a recording played for jurors Tuesday, McDonald told state police detectives that he and his mother got along well.

McDonald was missing from the home when his mother’s body was discovered, and he was arrested the next day on Bailey Island in Harpswell.

Twenty-four witnesses testified during the two days of the trial. McDonald intended to testify, Billings told jurors at the trial’s outset.

Billings told the judge Wednesday that he and McDonald discussed the guilty plea and its consequences for more than three hours at the jail on Tuesday night, and talked again in a room just outside the courtroom Wednesday morning.

At the hearing Wednesday morning, Assistant Attorney General Leane Zainea summarized the evidence in the case and referred to testimony that had been heard in the trial. She told the judge that the 40-year capped sentence in exchange for the plea was offered to the defense months ago.

Zainea said Janice McDonald’s other children had been notified about the recommended sentence. No McDonald family members have been in court, except when called to testify.

“He has since Sept. 1 of last year acknowledged his role in his mother’s death,” Billings told the judge.

He said the case for manslaughter would have required a showing of adequate provocation. “It became clear that defense would not be generated by Mr. McDonald’s testimony,” he said.

Billings said he and Dr. Charles Robinson, a psychologist working for the defense, were convinced that McDonald understood what he was doing in pleading guilty to murder.

After the hearing, Billings said McDonald initially denied killing his mother because he was scared, but he admitted it soon afterward to Robinson and to doctors with the State Forensic Service.

“He knows this was a horrendous act and is tortured with guilt and knows he’s got to be punished and feels like he deserves to be punished,” Billings said.

Billings said McDonald truly misses his mother.

“He’s really been lost because of this,” he said. “There really was a close relationship.”