Court documents reveal the Massachusetts man accused of raping and killing his 11-year-old niece regularly gave her and her brother sleeping pills when he babysat them.

>> Read more trending news

Miguel Rivera, 58, of Lawrence, is accused of drugging and raping his young niece, giving her drugs that later caused her death due to fentanyl exposure.

Rivera had been watching the two children on the night of Dec. 14, into Saturday, Dec. 15, telling police he picked them up in Haverhill on Friday at around 6:30 p.m.

Early Saturday morning, Rivera called 911 saying his niece was under medical distress. She was rushed to the hospital, but was pronounced dead days later.

Documents reveal Rivera not only drugged the 11-year-old and her brother on the night she was hospitalized, but that he would give both children small, red pills to swallow at bedtime every time he would watch over them.

Forensic interviewer Pat-Snyder Mathews deemed the 11-year-old's brother competent and said he "understood the importance of telling the truth." In a testimony, the boy described the pills his uncle gave them as "coming from a prescription-type bottle that his uncle kept on or in a drawer."

According to documents, he said the pills "helped them sleep" and that they were given to them by Rivera "every time they stayed over."

When questioned by police if he had given the girl pills to help her sleep, Rivera denied any allegations. Rivera said he flushed the pills down the toilet, but only "because he thought she took one, not because he gave her one."

He added that, it was at that point that he remembered he kept more pills in his drawer, which he also flushed down the toilet.

Rivera is seen on surveillance footage leaving his one bedroom apartment and going into the communal bathroom multiple times in the night, starting at 3:13 a.m., at which point his niece was already in medical distress. Detectives said Rivera only called 911 at 3:26 a.m.

Documents show Rivera told detectives he never left his room during the time prior to him finding his niece unconscious.

Rivera told detectives he had been prescribed sleeping pills, but hadn't taken them for over a month. Further investigation revealed a Walgreens pharmacy in Methuen dispensed 30 tablets of 50 mg of Amitriptyline, which can be dispensed in the form of a small, red pill.

Toxicology reports showed the 11-year-old girl had both fentanyl and amitriptyline in her system.

Laboratory reports showed Rivera's DNA was also found on the girl's body.

According to the police report, the responding officer says "based on all of the above evidence, I have probable cause to believe that Miguel Rivera committed the crime of rape of a child by force."

Rivera, who is currently at the Middleton House of Corrections, was attacked inside the jail about a month ago.