MIAMI — Florida lawmakers gave final passage to a $400 million gun control and school safety bill on Wednesday in defiance of the National Rifle Association, which opposed the legislation’s firearm restrictions. The bipartisan vote came three weeks after a gunman killed 17 people in a rampage at Marjory Stoneman Douglas High School in Parkland, Fla.

The legislation, which passed the State Senate on Monday and now heads to the governor, would raise the minimum age to purchase any firearm to 21 from 18; impose a three-day waiting period on gun purchases; fund school police officers and mental health counselors; and allow local school districts and sheriffs to arm certain school personnel. It would also ban so-called bump stocks, which make guns fire faster, and give law enforcement more power to commit people deemed a threat.

While the gun bill was the first to pass in the state in years, it fell short of the demands of many of the students and educators who have in recent weeks led a national call for stronger firearm restrictions.

(Read our article about exactly what’s in the bill, and what’s not, here.)

The emotional debate in the House, which lasted eight hours, culminated with powerful remarks from Representative Jared Moskowitz, a Democrat who graduated from Stoneman Douglas High and told of attending the funerals of the dead. He broke down and needed a moment to compose himself when he shared that one of the victims, Jaime Guttenberg, was the daughter of his son’s preschool writing teacher.