A former student accused of carrying out the deadliest-ever shooting at a US high school is facing the death penalty after pleading guilty.
Nikolas Cruz on Wednesday pleaded guilty to all charges in the 2018 mass shooting at Marjory Stoneman Douglas High School in Parkland, Florida, which left 14 students and three staff dead and 17 others injured and became a rallying cry for gun control activists.
Cruz, 23, entered guilty pleas to 17 counts of murder and 17 counts of attempted murder in the Valentine's Day attack.
Watch: Parkland shooter Nikolas Cruz pleads guilty to all counts in Parkland School shooting
Cruz was a 19-year-old expelled student with a history of mental health and behavioural issues at the time of the "cold, calculated and premeditated" killings, Broward County's State's Attorney Office in Broward County said in court documents.
He had previously admitted to using a lot of marijuana and had taken a lot of the prescription tranquiliser Xanax.
The case will now head to a penalty trial in which jurors must determine whether Cruz is spared the death penalty to face life without parole.
In Florida, juries determine whether to impose a death sentence. If prosecutors are not willing to drop the potential death penalty as part of any plea deal that may be struck with Cruz, then a jury would decide.
Judge Elizabeth Scherer has said she hopes that the case - for which thousands of jurors will have to be screened - can begin in January.
During last week's hearing, Cruz pleaded guilty to assault and battery of a law enforcement officer in a separate case in which he was accused of kicking, hitting and punching a sheriff's deputy as well as attempting to remove his Taser in a November 2018 jail attack.
Before accepting his plea, Broward Circuit Judge Elizabeth Scherer asked him if he understood the impact the assault case could have in the penalty phase of the murder case.
"Yes, Ma'am," Cruz responded.
Following the plea, Cruz tearfully addressed the judge and the victims' families.
"I am very sorry for what I did and have to live with it every day," he said. "If I were to get a second chance, I would do everything in my power to help others."
Cruz added that he has "nightmares" about his crime and "can't live with" himself. He also said that he believes that the US would "do better if everyone would stop smoking marijuana".
Some of the teenagers who survived the deadly rampage formed "March for Our Lives", an organisation that called for gun control legislation such as a ban on assault-style rifles.
In March 2018, the group held a nationally televised march in Washington that sparked hundreds of similar rallies worldwide. Cruz was 18 when he legally purchased the AR-15 rifle used in the shooting from a licensed gun dealer.
In an event marking the third anniversary of the shooting in February, US President Joe Biden called for Congress to pass gun law reforms, including a ban on assault weapons and an end to legal immunity for gun manufacturers.
Watch: What is next in case against Parkland Shooter?