By John Clarke

WASHINGTON (Reuters) - A Maryland woman will be committed to a psychiatric hospital after pleading guilty on Friday to charges of killing two children during what she said was an exorcism, according to a prosecution official.

Monifa Sanford pleaded guilty to two counts of first-degree murder and two counts of attempted first-degree murder under a plea agreement, according to the state's attorney's office in Montgomery County.

As part of the deal, the defense and prosecution agreed that Sanford was not criminally responsible.

Judge Cheryl McCally of the county's Sixth Circuit Court ordered that Sanford be committed indefinitely to a maximum-security psychiatric hospital, according to Ramon Korionoff, a prosecution spokesman.

Sanford was one of two women charged in the attack last January.

Zakieya Avery, 28, the mother of the two children killed, told investigators that she and Sanford believed that evil spirits had possessed the children and that an exorcism was needed to drive the demons out.

Norell Harris, 1, and Zyana Harris, 2, were repeatedly stabbed at their home, a townhouse in Germantown, about 30 miles northwest of Washington, where Sanford also lived.

The children's siblings, aged 5 and 8, were injured but survived.

Avery has been charged with two counts of first-degree murder and two counts of attempted first-degree murder. A hearing in her case is scheduled for early spring.

(Editing by Jonathan Allen and Eric Walsh)