Image copyright Getty Images Image caption Wednesday's attack in Parkland was the deadliest US school shooting since 2012

President Donald Trump has rebuked the FBI for missing signals before Wednesday's school shooting in Florida.

The agency was "spending too much time trying to prove Russian collusion with the Trump campaign", Mr Trump tweeted.

"There is no collusion. Get back to the basics and make us all proud."

The FBI has admitted it failed to act on a tip-off about suspected shooter Nikolas Cruz, who has confessed to the shooting at a high school in Parkland in which 17 people died.

It was the deadliest US school shooting since 2012 and has re-ignited long-running debates about tougher firearm restrictions.

Earlier, students who survived the shooting rallied in Florida, demanding tighter legislation on gun control and criticising the president for receiving financial support from the National Rifle Association (NRA) during his presidential campaign.

What was President Trump referring to?

In his tweet, he wrote: "Very sad that the FBI missed all of the many signals sent out by the Florida school shooter. This is not acceptable."

He appeared to link the agency's failures in the specific case to the time it has spent investigating possible collusion between Russia and the Trump team during the 2016 presidential campaign.

He has repeatedly denied any links with Moscow.

Earlier this week, 13 Russians were charged with interfering in the US election, in a major development in an FBI investigation now led by Special Counsel Robert Mueller.

Three Russian companies were also named in the indictment.

Russian Foreign Minister Sergei Lavrov on Saturday dismissed the charges as "blather", saying he would not comment further until he saw "facts".

What mistakes did the FBI admit to?

It said it did not properly follow up on a tip-off about Mr Cruz last month when a person close to the suspect contacted the agency 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".

The 5 January tip was not the only information the FBI received.

In September, a Mississippi man reported to the law enforcement agency a disturbing comment left on a YouTube video under Mr Cruz's name.

Mr Cruz, 19, was also reportedly investigated by local police and the Department of Children and Family Services in 2016 after posting evidence of self-harm on the Snapchat app, according to US media reports.

Child services said he had planned to buy a gun, but authorities determined he was already receiving adequate support, the reports say.

What happened at Saturday's rally in Florida?

Students and their parents - as well as politicians - took part in the event in Fort Lauderdale, close to Parkland. Thousands of people attended, according to the Associated Press.

Arguably the most memorable moment came when high school student Emma Gonzalez took to the podium and attacked the US president and other politicians for accepting political donations from the NRA, a powerful gun rights lobby group.

Media playback is unsupported on your device Media caption Student Emma Gonzalez to lawmakers: "Shame on you!"

"If the president wants to come up to me and tell me to my face that it was a terrible tragedy and... how nothing is going to be done about it, I'm going to happily ask him how much money he received from the National Rifle Association," said Ms Gonzalez.

"It doesn't matter because I already know. Thirty million dollars," the 18-year-old said.

"To every politician who is taking donations from the NRA - shame on you!" said Ms Gonzalez, who took cover on the floor of her secondary school's auditorium during the attack.

Responding to her passionate speech, the crowds started chanting "Shame on you!"

According to the Center for Responsive Politics, the NRA spent $11.4m (£8.1m) supporting Mr Trump in the 2016 campaign, and $19.7m opposing Hillary Clinton.

Image copyright Joe Raedle Image caption Wednesday's attack was the deadliest US school shooting since 2012

Ryan Deitsch, who was among those hiding in a school toilet during the attack, urged lawmakers to pass more restrictive measures on gun ownership.

"The least lawmakers can do is vote on something. What's the worst that can happen?" the 18-year-old said.

In another development, a prominent Republican donor is threatening to withhold funding from candidates who fail to endorse legislation against assault weapons.

Al Hoffman Jr, a Florida real estate developer, announced the move in an email to several Republican leaders, including the state's governor, Rick Scott, according to the New York Times.

What is Mr Trump's stance on gun control?

In a tweet late on Saturday, the Republican president accused the Democrats of not acting on gun legislation "when they had both the House & Senate during the Obama Administration.

"Because they didn't want to, and now they just talk!" he wrote, referring to criticism from Democrats following Wednesday's shooting.

The president's views on gun control have shifted over time. In recent years, he has pledged to fiercely defend the Second Amendment to the US Constitution, which protects people's right to keep and bear arms.

Last year, he told an NRA convention he would "never, ever infringe" on that right. "The eight-year assault on your Second Amendment freedoms has come to a crashing end," he said.