Media playback is unsupported on your device Media caption Florida survivors on gun laws: 'Something has to change'

The FBI has said it did not properly follow up on a warning that Florida school shooting suspect Nikolas Cruz might carry out an attack.

Last month, a person close to the 19-year-old contacted the law enforcement agency to warn of "the potential of him conducting a school shooting".

But protocols were not followed and the tipline did not pass along the complaint, the FBI said.

It was not the first potential warning to the FBI regarding Mr Cruz.

Media playback is unsupported on your device Media caption Inside the classroom: 'We watched gunman shoot our friends'

He has confessed to carrying out Wednesday's attack at Marjory Stoneman Douglas High School in Parkland and has been charged with 17 counts of murder.

It was the deadliest US school shooting since 2012.

On Friday, President Donald Trump and First Lady Melania Trump visited a hospital in Florida where victims of the shooting were being treated.

A White House spokeswoman said the couple came to the hospital to "pay their respects" and thank employees for their response to the shooting.

The president and his wife later visited the Broward County sheriff's office to meet law enforcement officials who responded to the shooting.

"What a great job you've done," Mr Trump said, adding: "I hope you get credit for it because believe me, you deserve it."

What did the FBI say?

US Attorney General Jeff Sessions has said he is ordering a review of the justice department's processes in the wake of the FBI's mishandling of the tip.

The review will look at what went wrong and broadly examine how the justice department responds to such cases.

"It is now clear that the warning signs were there and tips to the FBI were missed," he said in a statement. "We see the tragic consequences of those failures."

Florida Governor Rick Scott said in a furious statement that the director of the FBI must resign. "The FBI's failure to take action against this killer is unacceptable," he said.

"The families will spend a lifetime wondering how this could happen, and an apology will never give them answers they desperately need."

The Republican governor said Americans must have confidence in the FBI to act on "see something, say something" tips.

A group of Florida lawmakers who travelled from the state capitol to visit the school on Thursday agreed to tear down and replace Building 12, where the massacre occurred.

"It will still be very difficult for students to return," Republican Senator Bill Galvano told the Miami Herald newspaper.

"But that particular building should be razed, and the memory of the perpetrator erased and a memorial honoring the victims and their families be put in its place."

What was the complaint?

On 5 January a person close to the teenager contacted the FBI tipline to provide "information about Cruz's gun ownership, desire to kill people, erratic behaviour, and disturbing social media posts, as well as the potential of him conducting a school shooting", said an FBI press release.

The agency said that under established protocols, the caller's information to the Public Access Line should have been assessed as a potential threat to life and passed on to the Miami field office.

"We have determined these protocols were not followed," said the FBI.

FBI Director Christopher Wray said the bureau is "still investigating the facts".

"I am committed to getting to the bottom of what happened in this particular matter, as well as reviewing our processes for responding to information that we receive from the public," he said.

"We have spoken with victims and families, and deeply regret the additional pain this causes all those affected by this horrific tragedy," he added.

In 2016, the FBI received about 1,300 tips a day through its website, which is staffed around the clock by two dozen people.

In addition to online tips, FBI field offices receive dozens of calls. About 100 of the tips are considered "actionable".

Media playback is unsupported on your device Media caption Chicago Cubs' Anthony Rizzo speaks at Florida shooting vigil

What was the other warning?

In September last year, a Mississippi man reported to the law enforcement agency a disturbing comment left on a YouTube video.

A user called "nikolas cruz" said: "I'm going to be a professional school shooter."

Ben Bennight said he spoke to FBI representatives for about 20 minutes. The bail bondsman said they contacted him again following the school shooting in Parkland.

The FBI confirmed on Thursday they had been made aware of the comment at the time.

They said they had conducted "checks", but were unable to identify the person behind it.

What do we know about the suspect?

Media playback is unsupported on your device Media caption Florida shooting suspect appears in court

Mr Cruz had been expelled from the school he has confessed to attacking and some students said they had previously joked he would one day "shoot up the school".

One former schoolmate, Chad Williams, said Mr Cruz was an "outcast" who was "crazy about guns".

His interest in weapons was apparent on his social media profiles, which the Broward County sheriff said were "very, very disturbing".

Mr Cruz had reportedly been treated for mental health issues at a clinic.

Who are the victims?

Aaron Feis, an assistant American football coach, security guard, is being hailed a hero for shielding students from bullets. He was fatally injured after diving in front of a pupil.

Geography teacher Scott Beigel was fatally shot while trying to barricade the door of his class and protect students.

The school's athletic director, father-of-two Chris Hixon was also killed.

The students who died were:

Alyssa Alhadeff , 14

, 14 Martin Duque , 14

, 14 Alaina Petty , 14

, 14 Alex Schachter, 14

14 Jaime Guttenberg , 14

, 14 Cara Loughran , 14

, 14 Gina Montalto , 14

, 14 Luke Hoyer , 15

, 15 Peter Wang , 15

, 15 Carmen Schentrup , 16

, 16 Nicholas Dworet , 17

, 17 Joaquin Oliver , 17

, 17 Helena Ramsey , 17

, 17 Meadow Pollack, 18

The news of the FBI's mishandled tip came the same day as some of the funerals for those killed took place.

President Trump tweeted on Friday that he plans to meet with family members of victims.