Video has been released of the confession by Nikolas Cruz, the 19-year-old accused of killing 17 students and teachers on Valentine's Day at a Florida high school.
In the heavily redacted video released Wednesday by prosecutors, Cruz, wearing a hospital gown and pants, can be seen entering an interrogation room with officers. The uniformed officers shackle his left ankle to the floor and remove his handcuffs.
For a period of time, Cruz is left alone in the room. He can be seen holding his head in his hands and then pointing to his head with his hand, simulating a handgun, and firing. He makes the same gesture, pointing into his mouth and again at his chest. He then punches himself repeatedly.
John Curcio, a Broward Sheriff's Office detective, eventually enters the room and sits across from Cruz. He asks him a few questions such as his name and date of birth.
"I'm the last guy you're gonna have to talk to," he tells Cruz. "What's happened has happened but now, me and you, we've gotta kind of communicate so I can hear you. ... You gotta relax."
He then leaves to get Cruz some water. When Curcio returns, he begins his questioning.
On Monday, ABC News obtained court documents that included a 217-page partial transcript of what Cruz allegedly told police after the deadly Feb. 14 shooting at Marjory Stoneman Douglas High School in Parkland, Florida.
In the transcript, he said he felt "worthless" and repeatedly indicated that he wanted to die. He admitted to carrying out the shooting and questioned why detectives had not killed him, according to court documents.
"I want to die. At the end, you are nothing but worthless, dude," he mumbles to himself, according to the documents. "You deserve to die."
Cruz also described a so-called demon in his head.
"I hear demons. ... A voice, demon voice," he said, adding that the voice had told him to hurt people on the night before the shooting. "The voice is, is in me. ... To me, it's me and then my bad side. ... It's a voice. The voice is in here and then it's me, it's just regular me, just trying to be a good person."
At one point, according to the transcript, Curcio asks Cruz about why he didn't seek professional help.
"You could have stopped the demon by getting a prescription for marijuana. You could have stopped the demon by getting a prescription for Xanax. ... You could have stopped the demon any time you want. You didn't want to stop the demon," Curcio said. "Why didn't you want to stop the demon?"
"I don't like the demon," Cruz said. "I don't like the demon. ... I'm scared of him. ... Why wouldn't he protect me, man?"
He ends the interrogation and requests an attorney. In the released video, he can be seen crying, burying his face in his lap and scraping at his right arm after the detective leaves. Curcio returns and handcuffs Cruz behind his back.
Later, according to the transcript, Zachary Cruz, Cruz's brother, enters the room along with Curcio.
"People think you're a monster now," Zachary Cruz tells Cruz. "Why did you do this?"
"I'm sorry, dude," Cruz says. "I love you."
On Feb. 14, Cruz took an Uber to the school, allegedly opened fire on students and staff and then slipped away from the campus by blending in with other students who were trying to escape, police said. He was later apprehended.
Prosecutors released the video Wednesday in response to a court order after news organizations including ABC sued under Florida's public records law.
He is charged with 17 counts of murder. Authorities have yet to release details on why the former Marjory Stoneman student allegedly stormed into the school with an AR-15. A judge entered a not-guilty plea on his behalf during his arraignment in March.
ABC News’ Karma Allen contributed to this story.