A Suffolk judge ruled Thursday a Huntington man who stabbed his stepfather to death four years ago has a dangerous psychiatric condition and ordered him confined to a mental hospital.

Matthew Hubrins, 32, pleaded not responsible by reason of mental disease or defect — commonly known as an insanity plea — in May to a charge of second-degree murder. One night in June 2012, he came home, got a knife from the kitchen, walked into a bedroom where Noel Mohammed and Hubrins’ mother were sleeping and stabbed Mohammed in the chest.

advertisement | advertise on newsday

Mohammed, a well-liked postal carrier in Huntington and a Christian minister, died soon afterward at Huntington Hospital. Hubrins, a musician, had struggled with drugs and mental illness in the years before the killing.

Assistant District Attorney Guy Arcidiacono told state Supreme Court Justice Richard Ambro in Riverhead that two doctors had diagnosed Hubrins with schizoaffective disorder, bipolar type. They said Hubrins’ lack of insight into his condition and his resistance to treatment made him a danger to himself and the community.

Defense attorney Ira Weissman of Central Islip said a third doctor he hired to examine his client came to similar conclusions, so he would not contest an order to have his client confined in a psychiatric hospital.

Ambro noted that Hubrins’ mental illness “prevents him from appreciating the wrongfulness of his actions.”

advertisement | advertise on newsday

As the defendant left the courtroom, Ambro told him, “Mr. Hubrins, good luck.”