PARKLAND, Fla. – In the two years before the Parkland school shooter went on his rampage, he warned people — at least four times — what he planned to do.

Nikolas Cruz posted repeated threats on social media for anyone to see. At least three of them were reported to authorities, who did nothing to stop him. At least one other internet posting went unreported.

"The man did everything but take an ad out in the paper [saying], 'I am going to kill somebody,' " Sen. Lindsey Graham, (R-S.C.), said as the Senate Judiciary Committee examined how the Cruz case was handled.

Cruz's blatant warnings were exactly what you would expect from a mass killer in the internet age, as was other behavior leading up to the shootings, according to a new FBI study.

The study analyzed the pre-attack behavior of 63 shooters who killed multiple people from 2000 to 2013. More than half had communicated to someone — online or in person — that they intended to harm someone. The younger the perpetrator was, the more likely they were to engage in what the experts call "leakage."

Cruz followed the playbook in other ways, too. He spent a considerable amount of time planning the crime, legally purchased the AR-15 rifle he would use, recorded a series of cellphone videos attempting to explain his grievances, had a morbid interest in the 1999 Columbine school shooting in Colorado, and experienced a series of personal difficulties in the year before he attacked.

More and more mass killings

Mass killings like Cruz's are on the rise. In 2017, 30 mass shootings took place in the United States, the most ever in one year, the FBI said. Halfway through 2018, such shootings have already included the Parkland attack, which killed 17 people; the Santa Fe High School shooting in Texas, which killed 10; and the mass shooting of five newspaper employees June 28 in Annapolis, Md.

The Annapolis gunman also made no secret of his intentions. In a 2014 legal pleading, Jarrod Ramos wrote that he had "sworn a legal oath he would like to kill" a columnist he said had defamed him.

The commonly held ­perception that mass shooters are mostly mentally ill people who brood in silence and give few warning signs is incorrect and could hamper efforts to identify attackers before they kill, said Andre Simons, the agent in charge of the FBI's Behavioral Analysis Unit and a study co-author.

"They don't snap," Simons told law enforcement experts at a national school safety summit hosted by the FBI last month in Washington.

The new research shows that only 1 in 4 of the mass shooters in the study had ever been diagnosed with a mental illness. Cruz does not appear to have been diagnosed with any severe or psychotic mental illness, though state records indicate that he was treated for depression, attention deficit hyperactivity disorder and emotional behavioral disability. His mother had told officials he had obsessive-compulsive disorder, anger problems, anxiety and autism.

More than 75 percent of the shooters studied spent a week or longer planning their attacks. Some spent months, even as much as two years. Though it's unclear how much time Cruz spent plotting his rampage, he bought the firearm he used one year before the massacre. And evidence released recently shows that he sent a private message to a young friend in 2017 saying that he planned to kill people in a park in 2020.

Why so many mass shooters choose to signal their plans online is still being studied, but experts say many of the potential offenders may be "living in a muted way in real life" but frequently interact "more vividly online."

Cruz's disturbing proclamations on social media spanned at least two years.

1966 Texas tower shooting

For example, in February 2016, shortly after Cruz began attending Marjory Stoneman Douglas High School full time, a neighbor's son reported to the Broward Sheriff's Office that Cruz had posted on his Instagram account that he "planned to shoot up a school." In May 2017, nine months before the Stoneman Douglas attack, a Nikolas Cruz posted a comment under a documentary video titled "Texas University Clock-tower Sniper 1966," about a mass shooting in which 14 people were killed and 31 other were injured. "I am going to (do) what he did," the person wrote.

Senior FBI officials have publicly acknowledged they botched their handling of the two tips about Cruz that were reported to them in the five months before the massacre.

Cruz's and Ramos' actions were not included in the FBI's study.

But the Parkland shooter, just like 30 percent of the studied mass shooters, left what experts call a "legacy token" — a communication prepared in advance by the offender to claim credit and offer motives.

Cruz recorded three videos on his cellphone, which were discovered after his arrest. At least one video was recorded on the day of the attack. The others appear to have been made beforehand.

"My name is Nik, and I'm going to be the next school shooter of 2018," he says in the first of his video clips. "My goal is at least 20 people."

"I hate everyone and everything. I had enough of being told what to do and when to do," he said.

A large number of the shooters studied shared a sense of victimization and did not handle adversity well. Simons, the FBI behavioral expert, said many of the shooters were nursing grievances — real or perceived — that appeared to have played into their motivation. Though the grievances might not make sense to others, they were "narcissistic and profound" to the individuals, he said.

All but a very small share of the study's shooters bought their guns legally, like Cruz. Only five of them, or 8 percent, stole or purchased their firearms illegally. Cruz bought his AR-15 legally when he was 18, investigators said.

The study also dispelled the myth that only loners or those on the fringes of society attack. The majority of the shooters lived with other people or had significant real-life or online interactions. Cruz spent the last couple of months before he was arrested living with a school friend's family in Parkland.

FBI leaders, while acknowledging failures, say they hope the research findings will dispel common myths and help investigators and the general public identify and report potential shooters in the future — before they strike.

Many people are reluctant to report such suspicions about a family member, friend or peer, they said, but it could make a huge difference in averting violence and getting the person help.

However carefully law enforcement experts study mass shootings, Simons said: "I'm aware of offenders who do so even more meticulously."

"At least one person noticed a concerning behavior in every active shooter's life," Simons said. "We suspect there are individuals out there who are planning their attacks as we speak."