PROVIDENCE — A Superior Court judge this week found a Providence man competent to stand trial for the 2011 murder and kidnapping of his girlfriend, the day after he was released from prison.

Judge Susan E. McGuirl on Thursday issued a written ruling finding that Matthew Komrowski, 42, was able to understand the character and the consequences of the proceedings against him and able to "properly" assist in his defense. The judge, however, ordered that Komrowski remain at Eleanor Slater Hospital to ensure that he didn't decompensate prior to or during his trial.

Komrowski, of Providence, is accused of beating and stabbing to death 38-year-old Shirley Donnelly, a mother of three, in June 2011 and then setting her apartment on fire in an effort to cover up the crime. Donnelly, who met Komrowski online while he was in prison, was found dead in a locked bedroom in an apartment at 575 Dyer Ave., in Cranston.

Komrowski was released from the Adult Correctional Institutions the day before Donnelly's death, according to prison officials. The court first declared him incompetent to stand trial in 2014. He has since been evaluated every six months, with doctors issuing dueling reports about his mental capabilities.

McGuirl's ruling details a long, complicated mental health history for Komrowski, who was hit by a tractor trailer on Manton Avenue at age 9 and left very seriously injured and in a body cast. Doctors could not find any physical brain injury, but his family reported that he was plagued with behavioral problems at school after the crash.

He was repeatedly admitted to Bradley Hospital. He was labeled a "dreadful" management problem for institutions due to repeated suicide attempts, self-mutilation, inserting foreign objects into his body, and engaging in or threatening hunger strikes.

His diagnoses include borderline personality, malingering, and antisocial behavior that experts told the court made him "an unusually difficult patient to work with and to treat."

Through the years since his arrest, doctors have come to differing conclusions regarding Komrowski's status. Two doctors and the hospital itself at one point declared that they had a conflict in treating him because they did not believe he was incompetent. An outside expert, Dr. Howard V. Zozana, was brought in. Doctors also expressed concern that Komrowski was inflating his symptoms as a means of manipulation.

McGuirl based her recent competency finding on an April report by Zozana that said Komrowski "is now able to properly assist his attorneys with a reasonable degree of rational understanding, if he so chooses." He is being represented by Collin Geiselman, of the public defender's office.

Komrowski has a lengthy criminal record, including assault, larceny, arson and robbery. His prison disciplinary record includes 96 rule infractions, including receiving contraband, destroying property, and assault and battery.

John Krollman is prosecuting the case.