Nikolas Cruz has been charged with 17 counts of premeditated murder following a school shooting in Parkland, Florida, on Wednesday.

Cruz was transferred to Broward County jail early Thursday and is expected in court later in the day.

Students and teachers streamed out of Marjory Stoneman Douglas High School Wednesday shortly before 3 p.m. local time as Cruz, a former student, opened fire with an AR-15–style rifle.

He had legally purchased the AR-15 rifle about a year ago, a law enforcement official familiar with the investigation told the Associated Press on Thursday.

A teacher at the school said that he had previously been identified as a potential threat to students, and had been banned from taking a backpack onto campus, while a former classmate said he "talked about guns a lot."

Shortly after the charges were announced, President Donald Trump tweeted that there were "so many signs that the Florida shooter was mentally disturbed, even expelled from school for bad and erratic behavior."

"Neighbors and classmates knew he was a big problem. Must always report such instances to authorities, again and again!" he wrote, hours before the White House announced he planned to address the nation about the shooting at 11 a.m. ET.

A family member told ABC News that Cruz and his younger brother were adopted. His adoptive father, Roger Cruz, died a few years ago and his mother, Lynda, died last November.

The brothers were then left in the care of a family in Palm Beach County.

Jim Lewis, the family's attorney, told CNN on Thursday that they had seen "some depression," but that he "seemed to be doing better" after they helped him get a job at a Dollar Tree store and got him enrolled in adult education classes.

"There was indication there may have been some bullying going on. He had been away from the school over a year. He had never shared any contempt for the school or anybody here. No anger. Just a lot of depression and stuff going on around the loss of his mother," Lewis said.

The family didn't see any danger, he added, and were "horrified just like everybody else."

On Wednesday morning Cruz had refused to go to his adult education school, where he was studying for his GED. When the father of the family tried to wake him, he said, "It's Valentine's Day. I don't go to school on Valentine's Day", according to Lewis.

"They blew it off... This is a 19-year-old kid that just didn't want to get up and go to school that day and left it at that," Lewis said.

The family's son, who was a student at Marjory Stoneman Douglas High School and was there during the shooting, had apparently exchanged texts with Cruz earlier on Wednesday, but wasn't aware that anything was wrong.

"Just 'How you doing? What's going on? Yo, you coming over later?' That kind of stuff, nothing to indicate that anything bad was going to happen," Lewis said.

The family were aware that Cruz had a gun, but made him keep it locked in a gun safe, he added.

"It was his lock box, and his gun, in his room," Lewis said. "These folks are horrified. They did not see this coming at all from this young man."

"They had it locked up and believed that was going to be sufficient, that there wasn't going to be a problem. Nobody saw this kind of aggression or motive in this kid that he would ever do anything like this."

In September, a YouTuber alerted the FBI to alarming comments that a user named Nikolas Cruz left on his videos.

"I'm going to be a professional school shooter," the user wrote.

A media briefing is expected to take place near the school at 10:30 a.m. local time, Broward County Sheriff Scott Israel tweeted on Thursday morning.

This is a developing story. Check back for updates and follow BuzzFeed News on Twitter.