BANGOR, Maine — A local woman charged in connection with the stabbing death of her boyfriend last year pleaded no contest to murder Thursday at the Penobscot Judicial Center and was found guilty but not criminally responsible.

Gail Judd, 53, of Bangor was immediately sentenced to be confined to a mental health facility in Augusta.

Judd pleaded not guilty last year to intentional or knowing murder in the death of Michael Drouin, 47, on Feb. 22, 2012, in her Court Street apartment. In January 2013, she changed that plea to not guilty by reason of insanity.

She did not address the court Thursday.

Members of the victim’s family did not attend the sentencing.

Defense attorney Jeffrey Silverstein of Bangor presented evidence to Superior Court Justice William Anderson that Judd suffered from an abnormal condition of the mind when she stabbed Drouin because her liver is failing.

That condition, called hepatic encephalopathy, causes too much ammonia to be in her system, which in turn puts Judd into states of delirium, Silverstein said Thursday. He told the judge that Judd may have been in such a delirious state when she killed Drouin.

Judd told neighbors she stabbed Drouin in self-defense after he raped her, according to the affidavit filed following her arrest a few days after the stabbing.

After rendering his verdict, Anderson sentenced Judd to be confined to Riverview Psychiatric Hospital in Augusta for an indefinite period of time.

“All the experts agreed and this outcome is consistent with what the facts revealed — that she was not in touch with reality at the time of the incident,” Silverstein said after the sentencing.

Assistant Attorney General Andrew Benson, who prosecuted the case, did not oppose Silverstein’s motion that Judd was not criminally responsible for her actions.

“This was the appropriate outcome,” the prosecutor said after the sentencing. “Judd clearly had a mental disease and failed to appreciate the wrongfulness of her conduct.”

Had Judd been found criminally responsible, she faced a sentence of 25 years to life in prison.