She reportedly called police at 4am and when officers arrived at the Moana Ave home they found Maggie dead.
Sen was treated for what were described as "superficial injuries" and was in mental health care when her daughter's funeral was held.
She was charged with murder in February this year and pleaded not guilty. The trial had been scheduled for next month.
Dr Mhairi Duff, a psychiatric expert who has seen Sen since Maggie died, has given evidence at today's hearing, before Justice Matthew Downs, about the mother's "untreated psychotic delusions".
She said leading up to Maggie's death the child had been waking up in the night screaming.
Sen fed the child tablets at about midday on August 6 then took an overdose to kill herself.
Sen woke hours later, around dinner time, to find Maggie dead and was highly distressed that she herself was still alive.
She took a second overdose and then cut her wrists in a bid to end her life.
"She realised her daughter was dead and took a further overdose. She moved around the house in a distressed state," Duff told the court.
She said there were blood trails around the house and the words "Pastor John" written in blood in the kitchen.
She explained that Sen had been raised as a religious person and had strong beliefs.
Sen's diary contained writings about scriptures that were "unconventional and bizarre".
"At the time of [Maggie's death] she was labouring under a complex delusional belief system.
"She believed her daughter was being tortured and at risk of possession. Her evidence for this came from a delusional belief system," Duff said in evidence.
"Her daughter would wake up screaming in the night. Night after night - and [Sen] could not bear her suffering.
"She did not think these were nightmares, that they related to real events. Rather, this was evidence of possession by evil spirits, that her daughter was already experiencing torture."
Duff said Sen "needed to save and protect" Maggie.
She feared for the child's soul and did not think anyone else could help her.
"She thought of killing herself and her daughter, but had been able to resist. She believed if she killed her daughter her daughter would die an innocent and accepted into heaven.
"She accepted her own fate of going to hell."
Duff said Sen knew what she had done was morally wrong, and she was distressed that she would go to hell, that she had sinned.
But at the time of the killing she thought she was doing the only thing she could for her daughter.
Justice Matthew Downs concluded Sen was not guilty for the death of Maggie.
"I accept the only reasonable verdict is one of not guilty by reason of insanity," he said.
"Clearly she was mentally unwell. I am satisfied that the defendant suffered a disease of the mind at the time she killed Maggie."
Justice Downs said when Sen killed Maggie she believed she was acting morally.
"She believed she and her daughter were posessed by demons," he said.
Her beliefs combined with her mental disorder were so intense that Sen was rendered incapable of knowing whether her actions were right or wrong.
Justice Downs has made an order detaining Sen as a special patient.
She will be held indefinitely as a patient at a forensic psychiatric facility.
He said vulnerable people who came into Sen's care were at risk and equally as importantly, Sen needed care for her mental disorder.
Sen was also at risk of suicide or self harm.
"I have no doubt a special patient order is necessary," he said.
Investigation head Detective Inspector Hayden Mander said: "We note the judgment of the court in this matter and offer our ongoing condolences to Maggie's family."
Maggie's last hours
Sen took her daughter to the beach on August 6 and the pair returned to their Moana Ave home about lunchtime.
There would be no further human contact with the pair until Sen called 111 at 4am the next morning.
Duff said Sen was sitting at the kitchen table when she decided to kill the little girl.
She was overwhelmed with concern for Maggie and felt the "only solution" was to kill her, and then kill herself.
"It came to her very suddenly in clarity," Duff said.
She said Sen told her: "Now is the time. This is where I must act."
Sen gave Maggie a large dose of mirtazapine, an antidepressant used to treat major depressive disorder.
She then took pills herself.
But the dose was not enough and she woke hours later.
She knew what she had done was wrong, and was panicked about going to hell.
"I must have been demonically possessed. The devil got inside my head. It was wrong," Sen told Duff.
Duff said despite having "untreated psychiatric delusions" she had managed to function as a mother and cared well for Maggie until her death.
"There was no indication that the child had been neglected or abused," Duff told the court.
"There was no indication that the act on the day was anything other than an attempt by a good mother to protect her child from an unacceptable fate that no one else was able to help her escape," she said.
"She believed this act was morally right.
"She had a clear intention to kill herself as well as her daughter. She continues to ask herself why she lived and her daughter died."
The court heard when police arrived at the house in the early hours of August 7 they found Maggie dead in the lounge.
There was evidence of rigor mortis and it was clear the little girl had been dead for some time.
A post-mortem examination would later reveal Maggie's body contained more that 130 times an adult's dosage of mirtazapine.
A finding of insanity
Today's hearing was being held under section 20 of the Criminal Procedure (Mentally Impaired Persons) Act 2003.
That section states that before or at a trial a judge must find the defendant not guilty on account of insanity if:
• The defendant indicates he or she intends to raise the defence of insanity; and
•The prosecution agrees the only reasonable verdict is not guilty on account of insanity; and
•The judge is satisfied, on the basis of expert evidence, that the defendant was insane within the meaning of section 23 of the Crimes Act 1961 at the time the offence was committed.
In most New Zealand cases when someone is acquitted of a crime on insanity grounds, the presiding judge orders them detained as a special patient.
They remain detained at a forensic mental health facility until the Minister of Health or National Director of Mental Health deem they are no longer a risk to themselves or others.
Why the media were banned from filming Sen in court
Justice Matthew Downs declined media applications to film Sen in court after hearing from defence lawyer Stephen Bonnar, QC, and Crown prosecutor Brett Tantrum.
Bonnar said it was "beyond dispute" that his client was suffering, and had been suffering "for a long time from a significant mental illness".
"The circumstances under which she comes before the court can only be described as tragic," he told the court.
"It is important that her ongoing treatment is able to proceed and continue without the additional trauma and added distraction which might occur by her image being splashed across national media.
"I accept the media have a role and a duty and a right to report on these proceedings and they can do so. There is no added public interest in simply having [Sen's] image splashed everywhere.
"I go as far as to say that given the circumstances and her mental illness it would be bordering on inhumane to permit filming of photography at this time of intense emotional anguish for her and her family."
Tantrum also opposed the media filming Sen, saying she still had "a level of unwellness" and he agreed with Bonnar's submission.
Justice Downs said he was satisfied that there should not be any filming or photography of the proceedings.
"The issue for determination is whether the defendant was insane when she killed her young daughter and if so, what should happen to her. I have already read expert evidence in connection with this case," he said.
"It is beyond doubt the defendant suffers a mental illness and that she continues to do so.
"An expert retained by her is of the opinion that if the proceeding was filmed or photographs were taken of her that could interfere with her treatment.
"Declining this aspect of the applications does not reasonably inhibit the media's right to report these proceedings.
"The case is unusual and the features I have mentioned tell against photography or filming."
Read Justice Matthew Downs' full ruling: