The intruder, identified as Marcelo Arrellano-Garcia of Stone Park, is being held at the DuPage County Jail on bond of $1 million, according to CBS Chicago.
It was early on Saturday morning in unincorporated Addison. Police say a barefoot stranger - Arrellano-Garcia - came upon a home and tried the door.
It was unlocked.
He went inside and found a 6-year-old girl asleep in the living room. Police say he lifted the sleeping girl and took her to the second floor and her mother's bedroom.
"I just felt someone lay my daughter down next to me. At first I thought it was my husband," the girl's mother, Trinidad Sanchez, told CBS Chicago.
Moments later, she says she saw the intruder sitting next to the bed, with his back turned to her.
"I just jumped off the bed and just pulled my daughter toward me. I started yelling for my husband," she says. "The guy got up, and I told him, 'Who are you?' and he gets up and he says, 'I'm William -- this is my house.'"
Sanchez says her husband and brother-in-law struggled with the intruder and subdued him, then called 9-1-1. DuPage sheriff's officers arrived and arrested the suspect.
Later, Arrellano-Garcia, 21, was examined at Elmhurst Memorial Hospital, where prosecutors say he told doctors, "God told me to do this. God told me to shed some blood."
Doctors told prosecutors the suspect showed signs of "acute psychosis."
In court on Monday, the suspect - charged with felony trespass and battery - was ordered held on that $1 million bond.
Trinidad Sanchez says she is thanking God that things turned out as they did.
"He could have walked right out the door with my daughter," she said.