Updated June 25, 2022 at 9:19 a.m.

President Biden on Saturday signed into law the first major gun safety legislation passed by Congress in nearly 30 years.

The signing comes just over a month after the mass shooting at a Texas elementary school killed 19 children and two adults. That attack came 10 days after a racist mass shooting at a Buffalo, N.Y., supermarket killed 10 Black people.

"While this bill doesn't do everything I want, it does include actions I've long called for that are going to save lives," Biden said just before signing the measure.

"Today, we say more than enough. We say more than enough," he added. "At a time when it seems impossible to get anything done in Washington, we are doing something consequential."

The legislation, which passed the House 234-193 Friday night following Senate approval Thursday, includes incentives for states to pass so-called red flag laws that allow groups to petition courts to remove weapons from people deemed a threat to themselves or others.

In addition, the bill expands an existing law that prevents people convicted of domestic abuse from owning a gun to include dating partners rather than just spouses and former spouses.

It also expands background checks on people between the ages of 18 and 21 seeking to buy a gun.

The National Rifle Association says it opposes the bill.

"This legislation can be abused to restrict lawful gun purchases, infringe upon the rights of law-abiding Americans, and use federal dollars to fund gun control measures being adopted by state and local politicians," the NRA said in a statement Tuesday.

Sen. Chris Murphy, D-Conn., who led the negotiations between 10 Senate Republicans and 10 Democrats, called the bill a compromise right before the Senate vote began Thursday.

"It doesn't do everything I want," Murphy said. "But what we are doing will save thousands of lives without violating anyone's Second Amendment rights."

The Supreme Court struck down New York law restricting concealed carry

Biden's action also comes just days after the U.S. Supreme Court issued a landmark decision saying there is a constitutional right to carry a handgun in public for self-defense, striking down a New York law that restricted concealed carry.

New York Gov. Kathy Hochul called the decision "reckless" and "reprehensible."

"Our states and our governors have a moral responsibility to do what we can because of what is going on: The insanity of the gun culture that has now possessed everyone all the way up to even to the Supreme Court," Hochul said shortly after the decision Thursday.

There have been at least 281 mass shootings in the U.S in 2022, according to the Gun Violence Archive. As of June 8, there had been 27 shootings at schools this year, according to Education Week, which has been tracking school shootings since 2018.

Copyright 2022 NPR. To see more, visit https://www.npr.org.