The woman accused of killing her three sons was kept from a jailhouse courtroom because she posed a "danger to herself or others," a judge announced Sunday night.

Octavia Rogers, 29, faces three counts of murder in connection with the deaths of her three sons. She was booked into a downtown Phoenix jail on Sunday after being released from a hospital.

A judge decided Rogers must post a cash-only bond of $1 million in order to be released.

If released, Rogers will be subject to electronic monitoring and will not be allowed to have any weapons or be in contact with minors, a judge said.

Rogers' three sons were found dead at a north Phoenix home on June 2. Two boys, 8-year-old Jaikare Rahaman and 5-year-old Jeremiah Adams, were found in a closet. Two-month-old Avery Robinson was found inside a suitcase in the same closet, police say. All had suffered multiple stab wounds.

Rogers was found inside a bathroom of the house with multiple serious, self-inflicted stab wounds to her neck and stomach. She also reportedly tried to drown herself.

Police say Rogers had recently moved back to Phoenix to live with her brother and before giving birth to baby Avery. Her brother was the one who discovered the woman inside the home.

A source tells ABC15 the mother was on Spice at the time of the killings. The drug, known as synthetic marijuana, can have psychotic effects on some users, according to the National Institute on Drug Abuse.

The Arizona Department of Child Safety said it has history of abuse or neglect reports with the mother who allegedly killed her three children.

ABC15 News reached out to the family of Octavia Rogers. A woman who answered the phone said they were not in a position to do any interviews right now. She said the family was holding up as best as they could as this was all very tragic for them as well.