Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Florida Gov. Rick Scott on Friday signed into state law new gun restrictions ─ and a provision that allows teachers to arm themselves ─ crafted in response to the February killing of 17 people at a suburban high school.

The measure — dubbed the "Marjory Stoneman Douglas High School Public Safety Act" — raises the age to buy all firearms to 21, imposes a three-day waiting period for most gun purchases, allows trained school workers to carry handguns, provides new mental health programs for schools, and restricts access to guns from people who show signs of mental illness or violence.

Scott announced his support of the bill at a news conference with relatives of the Feb. 14 shooting in Parkland. He praised them, along with student survivors, for pressing lawmakers to improve school safety and keep guns out of the hands of dangerous people.

The Florida state legislature passed the bill this week.

Related: Florida Legislature sends gun and school safety bill to governor

“Every student in Florida has a right to learn in a safe environment. And every parent has a right to send their kids to school knowing they will return safely at the end of the day,” Scott said. “Today I am signing bipartisan legislation that will help us achieve that.”

The new law marks a rare act of defiance in Florida against the National Rifle Association, which wields considerable influence there and has supported Scott, a Republican.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

The NRA’s lobbying arm, the Institute for Legislative Action, said it was disappointed with the new law’s age restriction and waiting period.

"This bill punishes law-abiding gun owners for the criminal acts of a deranged individual," the NRA-ILA’s executive director, Chris Cox, said in a statement. "Securing our schools and protecting the constitutional rights of Americans are not mutually exclusive. Instead of looking to the root cause of this premeditated violence, the gun control provisions in this law wrongly blame millions of Floridians who safely and responsibly exercise their right to self-defense."

The NRA immediately responded to the new law with the announcement that it had filed a lawsuit against Florida — specifically directed at state Attorney General Pam Bondi — on Friday. The gun advocacy group claimed the age change in the state's gun laws infringed on adults' rights to own firearms, calling it "a blatant violation of the Second Amendment."

Student activists from the school where the shooting took place followed the bill's track closely and called it "a baby step."

"STEP ONE," tweeted Cameron Kasky,a survivor of the Marjory Stoneman Douglas High School shooting and organizer of the March For Our Lives demonstration, about Scott's signing of the bill.

Kasky included a simple "Good job" in his post.

But other student activists were less celebratory. David Hogg, another survivor and organizer, tweeted that people should not forget that Scott, Sen. Marco Rubio, R-Fla. and Florida state Rep. Elizabeth Porter "are STILL taking money from the NRA."

"The only reason they took action is because we did," Hogg said in his post.

Florida Gov. Rick Scott signs the Marjory Stoneman Douglas High School Public Safety Act, on March 9, 2018, in Tallahassee. NBC News

The suspect in the Douglas High shooting, 19-year-old Nikolas Cruz, legally bought the AR-15 rifle he allegedly used to gun down his victims, most of them students, according to authorities.

Related: First deputy at Florida school shooting disregarded training, investigator says

He'd been expelled from the school for disciplinary reasons, and police and court records revealed a long history of complaints about his behavior in the weeks and months leading up to the attack. The missed signs also included tips to the FBI.

Scott stressed the role of compromise in the measure's passage. He acknowledged that he didn’t agree with arming teachers, but was satisfied with a provision that allowed local communities to opt out. And he said he also didn’t see the point of extending waiting periods for gun purchases, because “it wouldn’t have had an impact on” the Parkland killer.

Scott also said he did not agree with a proposal, supported by many of the survivors, to ban certain types of semi-automatic rifles, like the AR-15. The new law does not include any such measure.

"I think rather than ban specific weapons, we need to ban specific people from having any weapon,” Scott said.