(Bloomberg) -- The US Senate voted 65-34 to advance bipartisan gun-safety legislation, lining up passage later this week of a measure hailed as the biggest breakthrough on the issue in decades. 

The vote came less than two hours after the Supreme Court struck down a New York law that required people to show a special need to carry a handgun in public, ruling for the first time that the Second Amendment protects gun rights outside the home.

The dueling actions, occurring across the street from one another, underscore the deep divisions in the country on gun policy against the backdrop of recent massacres at an elementary school in Uvalde, Texas, and a grocery store in Buffalo, New York, where a total of 31 people were killed last month. 

Senators, who have long struggled to find common ground on gun safety, restarted stalled negotiations after those killings, producing a bill aimed at improving background checks, securing schools and giving states federal funds to combat gun violence.

The House is expected to pass the bill and send it to President Joe Biden’s desk for his signature before leaving for a two-week recess. 

“By passing the Bipartisan Safer Communities Act, Congress will be taking meaningful action to save lives,” the White House said in a statement of support for the bill. “This legislation would be one of the most significant steps Congress has taken to reduce gun violence in decades, giving our law enforcement and prosecutors new tools to prosecute gun traffickers.”

Under the legislation, every state will have the opportunity for grants to help pay for crisis intervention programs, regardless of whether they set up “red flag” laws that allow judges to remove guns from potentially dangerous owners. 

It also provides for improvements to the national background check system, including giving states incentives to upload juvenile records to allow better reviews of gun purchasers aged 18 to 21.

The bill also will include billions of dollars in funding to help secure schools and bolster mental health resources.

The “boyfriend loophole,” aimed at barring convicted dating partners from buying guns, also would be closed. But in a compromise a person convicted of a misdemeanor for attacking a dating partner could be allowed to buy a gun again after five years. The provision is modeled after current law that allows domestic abusers to be restricted if they are married to, have lived with or have a child with the victim.

The bill also would provide stiff new federal criminal penalties for people who make straw purchases and traffic guns to be used in crime, or who illegally evade licensing requirements.

Supreme Court Voids N.Y. Gun Limits, Establishes Right to Carry

Details of the legislation were hashed out by four Senate negotiators: Republicans John Cornyn of Texas and Thom Tillis of North Carolina, and Democrats Chris Murphy of Connecticut and Kyrsten Sinema of Arizona.

Senate Minority Leader Mitch McConnell said this week he supports the bill as “a commonsense package.” 

“The American people do not have to choose between safer schools and the Constitution, and neither does the United States Senate,” the Kentucky Republican said Thursday on the Senate floor. “The American people want their constitutional rights protected and their kids to be safe in school. They want both of those things at once, and that is just what the bill before the Senate will have accomplished.” 

The National Rifle Association, however, announced its opposition to the bill Tuesday night. 

“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.

House GOP leaders oppose the bill and are urging Republicans in that chamber to vote against it. 

Read more: N.Y. Governor Hochul Says Supreme Court Ruling ‘Frightening’

Senate Majority Leader Chuck Schumer said he is working with Republicans to set up a vote on final passage of the legislation Thursday. If any senators object, the vote -- which requires only a simple majority -- will occur Friday. 

Everytown for Gun Safety, which advocates gun-safety measures, is backed by Michael Bloomberg, founder and majority owner of Bloomberg News parent company Bloomberg LP. The group filed a brief at the Supreme Court supporting the New York restrictions.

©2022 Bloomberg L.P.