Updated

The California legislature on Wednesday voted to raise the age for buying long guns throughout the state from 18 to 21.

Senate Bill 1100, introduced by Sen. Anthony Portantino, was approved with a 26-12 vote and sent to Democratic Gov. Jerry Brown for a signature, The Sacramento Bee reported.

The bill would limit those who can purchase rifles to age 21 and above. State law already limits the sale of handguns to people 21 or older.

Portantino cited the February massacre at Marjory Stoneman Douglas high school in Parkland, Florida — in which a 19-year-old used a AR-15-style gun to kill 17 people — as inspiration for the bill.

"The two most deadly recent school tragedies have been perpetrated by people under 21 with long guns,” Portantino said Wednesday. "We should be sending our children off to school knowing they are going to be safe, healthy and get a good education."

Opponents of the legislation argued that people can obtain long guns through illegal channels and that state legislators should focus on making sure criminals and those with mental health issues cannot get guns themselves.

Republican Sen. Jim Nielsen said he thinks "bills like this miss the target," according to the Los Angeles Times.

"What is magic about 21?" Nielsen asked. "All of a sudden you are not a danger anymore?

The bill includes exemptions for anyone under 21 who serve as police officers, in the military or have valid state hunting licenses.