In both cases, she slipped into deep depression and refused to leave her family’s house, her sisters and friends said. In 1978, she received treatment from a doctor and recovered. During the second episode, witnesses said she started expressing irrational fears about people coming to get her and returned to New York City.

Ms. Ortega’s siblings and other family members also testified that she appeared to be unraveling in the six months before the killings, crying frequently, asking people to pray for her and speaking of “shadows” and a “black man” following her and attempting to split up her family.

Her mental turmoil started when one of her sisters, Miladys Garcia, asked her to move out of the family’s apartment in Hamilton Heights, the witnesses said. She moved to an apartment in the Bronx belonging to another relative and insisted her teenage son, Jesus Frias, be sent from the Dominican Republic to live with her. She had left Mr. Frias with Ms. Garcia when he was 4 years old and had not raised him herself, except for an 18-month period around 2008.

Three days before the murders, she woke up in the middle of the night and started throwing pots and pans around the kitchen, then claimed later not to remember it, her sister Delci said.

Just four hours before the killings, Ms. Ortega visited a neighbor’s apartment and, agitated and pacing up and down, told a teenage woman staying there, Jennifer Reynosa, that she saw a “black shadow” that spoke to her. In more than a dozen interviews in the months after the murders, Ms. Ortega told Dr. Rosenbaum that she had been hearing voices, including Satan’s, telling her to kill herself and her employers’ children.

Prosecutors, however, focused on the statements Ms. Ortega made to Dr. Caffrey, the therapist, three days before the killings and to Dr. Marc Dubin, a psychiatrist who spoke to her 11 days after the horrific event as she was recovering from her neck wound at NewYork-Presbyterian Weill Cornell Medical Center.

In both interviews, Ms. Ortega complained about money trouble and expressed frustration with Ms. Krim about her schedule and workload, but did not mention hearing voices commanding her to kill.