Nikolas Cruz, who confessed to being the gunman in Wednesday's deadly Florida school shooting, according to his arrest affidavit, claimed to authorities that voices in his head told him how to carry out the ambush that left at least 17 people dead, ABC News reported.

Law enforcement sources referred to the alleged voices as "demons," according to the outlet, and said Cruz, 19, claimed that they told him what he needed to do to launch the deadly assault.

And between 2011 and 2016, authorities responded to 39 calls to Cruz's home in Parkland, WSVN reported. The issues varied "from domestic disturbance to child/elder abuse," the outlet said.

Details of Cruz's troubled past began to emerge in the hours after the massacre. In accounts from classmates, Cruz was described as a "weird kid" and a "loner," with one person adding that he was kicked out of school for getting into a fight with his ex-girlfriend's new boyfriend.

Prior to the shooting incident, the suspect was living in a mobile home with the family of a friend. Both of Cruz's parents, who adopted him, are deceased, according to the Sun Sentinel. His mother reportedly passed away in November.

Cruz confessed to using an AR-15 rifle to shoot “students that he saw in the hallways” at Marjory Stoneman Douglas High School “and on school grounds,” his arrest affidavit said. He also reportedly told authorities that he brought “additional loaded magazines” that he stashed in a backpack.

After arriving at the school in an Uber car on Wednesday, Cruz then entered the location, officials said. He pulled his weapon from a black, soft case and began firing bullets into several classrooms throughout the building, Broward County Sheriff Scott Israel said during a Thursday news conference.

Authorities received several 911 calls shortly before 2:30 p.m. reporting a shooting at the Parkland, Florida high school, the affidavit said, and as officers responded to the scene, a description of the shooter was sent out across police radios.

FLORIDA GUN STORE INVESTIGATED AS OFFICIALS CONFIRM IT’S WHERE SCHOOL SHOOTING SUSPECT BOUGHT AR-15

A witness who spoke to authorities said he recognized the “former troubled student” and alerted a co-worker “that Cruz was walking purposefully” towards one of the buildings, the affidavit said. Moments later, shots rang out and a “code red” was initiated.

In the midst of the chaos, Cruz confessed to ditching the weapons and ammunition in an attempt to “blend into the crowd,” the affidavit said. He fled the scene with others “fearing for their lives,” the sheriff said, and “was able to elude arriving officers,” according to the affidavit.

“Once the crime scene was secured the discarded AR15 rifle and vest with magazines was found in areas consistent with Cruz’s version of events,” authorities said in the document.

Cruz was apprehended by a Coconut Springs officer before 4 p.m. in Coral Springs and was taken into custody “without incident,” the sheriff said. Officials traced the rifle back to Cruz, who bought it legally in 2017, ATF Special Agent in Charge Peter Forcelli said Thursday.

PARKLAND SHOOTING VICTIMS INCLUDE YOUNG STUDENTS, COACH WHO SAVED OTHERS IN FLORIDA HIGH SCHOOL

The 19-year-old was booked into Broward County Jail on Thursday. He was later ordered held without bond and charged with 17 counts of premeditated murder.

“The victim’s deaths were caused by the criminal act of Nikolas Cruz and the killings done with a premeditated design,” the affidavit said.

After the hearing, defense attorney Melisa McNeill described her client as fully aware of what was going on but said he was also a “broken human being.” She added that Cruz was sad and remorseful for his actions and she was fully aware of the shooting’s impact on the community.

Jordan Jereb, the leader of the Republic of Florida, a white nationalist militia, previously told The Associated Press that Cruz was a group member and participated in paramilitary drills in Tallahassee. But Leon County Sheriff spokesman Lt. Grady Jordan told the outlet that his office had “very solid” information on the group and “there’s no known ties” between Cruz and the group “that we have that we can connect.”

The Associated Press contributed to this report.