Psychiatrist Dr. Miranda Grey (Halle Berry) works at a mental hospital and has a car accident after trying to avoid a girl (Kathleen Mackey) on a road during a stormy night, while driving back home. She rushes to try to help the girl. The girl turns out to in fact be a ghost, and possesses Miranda's body by burning her after she extends her hand to the girl. Miranda loses consciousness. Miranda next wakes up in the very hospital she works for, but as a patient treated by her co-worker, Dr. Pete Graham (Robert Downey, Jr.). Drugged and confused, she remembers nothing of what happened after the car accident. To her horror, she learns that her husband Douglas (Charles S. Dutton) was brutally murdered and that she is the primary suspect. While Miranda copes with her new life in the hospital, the ghost uses her body to carry out messages (most noticeably, she carves the words "not alone" into Miranda's arm) which leads her former colleagues to believe Miranda is suicidal and is inflicting the wounds on herself.Meanwhile, Miranda bonds with fellow inmate (and former patient) Chloe Sava (Penélope Cruz). Several times in sessions, Chloe had claimed that she'd been raped while in the hospital, but Miranda had always attributed these stories to mental illness. One night, the door to Miranda's room in the hospital is opened by the ghost that has been haunting her. When she passes Chloe's room in the hospital, she can hear the rape occurring and momentarily sees a man's chest pressed against the window. The man's chest bears a tattoo of an Anima Sola. Miranda realizes that Chloe was not making up these stories, and when she sees Chloe the next day, she apologizes, and the two embrace. Chloe warns Miranda her attacker said he was going to target Miranda next. Miranda begins regaining some of her memories bit by bit, and slowly comes to remember herself killing her husband. She realizes that the ghost had used her body to murder Douglas, thus making Miranda the patsy for his murder. This is why all of the physical evidence points to Miranda.Miranda escapes the hospital, having recognized the girl as a ghost. Seeking clues to the mystery of why she killed her husband, she goes to a farmhouse in Willow Creek, Rhode Island. In the cellar of the barn she discovers a room containing a blood-stained bed, what appears to be a box containing drugs, restraints, and video equipment. She watches the tape that is still in the camera and the viewer hears a woman screaming as if tortured or raped. In the final seconds of the video, Douglas walks into the shot, covers a woman's lifeless body on the bed with a sheet, and winks at the camera. At this point, police arrive, and one officer comes closer to Miranda and draws a gun on her while she is holding a knife to him. Miranda backs up to a stair case, and all of a sudden an injured, frantically screaming girl grabs hold of her from the adjoining crawlspace. The police release the girl, and Miranda is taken to jail. While she is in jail, Sheriff Ryan (John Carroll Lynch), who was Douglas' closest friend, talks to Miranda, and quizzes her on how she knew all these things. He does not believe her claim that ghosts told her everything, and asks her what sort of person the accomplice would be. Miranda uses her experience as a psychiatrist to give a psychological profile, and as she does so realizes that Ryan fits the profile perfectly. He attacks Miranda and in the fight reveals his tattoo an Anima Sola. Miranda kills the sheriff in an act of self-defense, with the help of the ghost.Miranda is next seen walking with Chloe on a city sidewalk discussing how each helped the other come to terms with their experiences. Miranda claims to be free of the ghost's influence and sends Chloe off in a taxi. Miranda then sees a young boy standing in the middle of the road who appears as though he is about to be struck by a fire truck. Miranda yells for the boy to move, but after the fire truck passes through the boy without harming him she realizes he was only a ghost. As Miranda walks away, a poster with the words "Have you seen Tim?" and a picture of the same boy is shown taped to a pole next to the street on which Miranda is walking.
Output: Question: Who is taken to jail?, Answer: Miranda