View more videos at: http://nbcphiladelphia.com.

PHILADELPHIA -- The man charged in the murder of a baby and her grandmother during a botched kidnapping and ransom scheme claimed that he killed both victims by accident, according to video released during his court appearance Wednesday.

Raghunandan Yandamuri, 26, is accused of murdering 10-month-old Saanvi Venna and her grandmother, Satyavathi Venna, 61, last month. It happened on Oct. 22, at an apartment complex in Upper Merion where both the Venna family and Yandamuri, a family friend, lived.

Police believe Yandamuri went to the apartment with the intention of kidnapping Saanvi and holding her for ransom. But police say Satyavathi, who was babysitting the child, fought for her granddaughter and was fatally stabbed by Yandamuri.

On Oct. 26, the baby's body was found in the basement of the apartment building and Yandamuri was arrested. Police say they also found a ransom note from Yandamuri demanding $50,000.

'Didn't mean to kill anyone'

On Wednesday, Yandamuri appeared in court for a preliminary hearing. During the hearing, a 23-minute video confession was played for the court, according to NBC10's Deanna Durante.

In the video, Yandamuri told police he "accidentally" slit Satyavathi Venna's throat and that he "didn't mean to kill anyone." The video also showed him confessing to stuffing a handkerchief in the baby's mouth and wrapping a towel around her head when she wouldn't stop crying.

More news from NBCPhiladelphia.com

Yandamuri said in the video that he put the baby in a suitcase, escaped via a fire escape and sneaked into the basement of another apartment building.

Yandamuri also told police that when he took Saanvi out of the suitcase the towel was still wrapped around her face and she was unconscious. He said he removed the towel and handkerchief, splashed water on her and left her in the basement while he returned home, took a shower and went to work.

He also told police he went back to the basement around 3:30 p.m. with a bottle of milk for the girl but that she was already dead.

Yandamuri's defense attorney argued in court that since his client did not mean to kill anyone, first-degree murder should be taken off the table. Prosecutors disagreed, citing Yandamuri's ransom note as evidence against the attorney's claim.

According to prosecutors, 10 copies of the ransom note were left in the apartment of the Venna family with several references that if they didn't bring $50,000 by 8 p.m. that night that the baby would be killed. Prosecutors say that showed there was intention and premeditation for murder. The judge agreed with the prosecutors and ordered that Yandamuri stand trial on charges of first-degree murder, kidnapping, robbery, theft and abuse of corpse.