The deranged gunman who allegedly killed 17 people at his former South Florida school told investigators that “demons” told him how to unleash the massacre, according to a report.

Law enforcement sources told ABC News that Nikolas Cruz, 19, said the voices in his head gave him instructions on how to carry out the attack at Marjory Stoneman Douglas High School in Parkland.

Cruz confessed to killing 14 students and three teachers with an assault rifle that he had bought legally after undergoing a background check.

He had bought the AR-15 just three days after his last day attending the school, on Feb. 11, 2017, and picked it up one week later on Feb. 18, 2017, an attorney for the gun store owner said in a statement.