The Senate on Thursday passed legislation aimed at stanching acts of mass gun violence, with 15 Republicans joining Democrats to advance a bill combining modest new firearms restrictions with $15 billion in mental health and school security funding.

The 65-to-33 vote represented an unlikely breakthrough on the emotional and polarizing question of U.S. gun laws, which have gone largely unchanged for more than 25 years, even as the nation has been repeatedly scarred by mass shootings whose names have become etched in history — from Columbine and Virginia Tech to Sandy Hook and Parkland.

But the May 24 killing of 19 students and two teachers inside a Uvalde, Tex., elementary school prompted renewed action, compelling a small group of senators to negotiate a narrow, bipartisan package focused on keeping guns away from dangerous potential killers while also bulking up the nation’s mental-health-care capacity with billions of dollars in new funding.

The resulting Bipartisan Safer Communities Act garnered support from all 50 members of the Democratic caucus and a cadre of dealmaking Republicans on Thursday, including Minority Leader Mitch McConnell (R-Ky.), who has opposed previous attempts to toughen gun laws after mass shootings.

“This is the sweet spot … making America safer, especially for kids in school, without making our country one bit less free,” McConnell said on the Senate floor Thursday.

In subsequent remarks with reporters, he explained the political logic of his stance, saying he hoped the GOP support for the deal “will be viewed favorably by voters in the suburbs that we need to regain in order to hopefully be a majority next year.”

“I thought it was time to act, and if [Democrats] were willing to join with us and pass legislation that actually targeted the problem, which is school safety and mental health, why would we not want to do that?” he added.

In addition to funding for mental health services and school security initiatives, the legislation expands criminal background checks for some gun buyers, bars a larger group of domestic-violence offenders from being able to purchase firearms, and funds programs that would allow authorities to seize guns from troubled individuals.

The legislation moves to the House, where it is expected to pass Friday. “While more is needed, this package must quickly become law to help protect our children,” House Speaker Nancy Pelosi (D-Calif.) said Tuesday.

President Biden, who called for much more thorough gun-control measures during a televised address this month, said he intends to sign the bill. “This bipartisan legislation will help protect Americans,” he said in a statement after the Senate vote Thursday night. “Kids in schools and communities will be safer because of it.”

McConnell’s support came despite the opposition of prominent gun rights groups, including the National Rifle Association, which said this week that the bill “does little to truly address violent crime while opening the door to unnecessary burdens on the exercise of Second Amendment freedom by law-abiding gun owners.”

But other players on the right lent support to the bill, which was primarily negotiated by Sens. John Cornyn (R-Tex.) and Chris Murphy (D-Conn.), as well as Sens. Kyrsten Sinema (D-Ariz.) and Thom Tillis (R-N.C.). The conservative Wall Street Journal editorial board endorsed the legislation Thursday, as did the National Sheriffs’ Association, which has close ties to GOP leaders.

Nonpartisan groups including the Fraternal Order of Police, the International Association of Chiefs of Police, the National Domestic Violence Hotline, the National Alliance on Mental Illness and the American Psychological Association also endorsed the bill.

Democrats and gun-control advocates, meanwhile, hailed the bill as a breakthrough — in terms of politics if not policy, by breaking decades of congressional deadlock on firearms laws.

“We are about to save a lot of lives,” Murphy said. “We’ve been building a movement around ending gun violence for 10 years, and we said one day we’d be strong enough to beat the gun lobby, and here we are.”

Senate Majority Leader Charles E. Schumer (D-N.Y.) said in a speech Thursday that the bill “is not a cure-all for all the ways gun violence affects our nation, but it is a long overdue step in the right direction.”

“The United States Senate faced a choice: We could surrender to gridlock … or we could choose to try and forge a bipartisan path forward to pass a real bill, as difficult as that may have seemed,” he said. “We chose to try and get something done.”

Shortly before the vote, Cornyn recounted the recent tragedy in his own state and said that afterward he “promised to do everything in my power to try to answer that call to do something.”

“I don’t believe in doing nothing in the face of what we saw in Uvalde and we’ve seen in far too many communities,” he said. “Doing nothing is an abdication of our responsibility as representatives of the American people.”

The 15 Republicans supporting the bill were Sens. Roy Blunt (Mo.), Richard Burr (N.C.), Shelley Moore Capito (W.Va.), Bill Cassidy (La.), Susan Collins (Maine), Joni Ernst (Iowa), Lindsey O. Graham (S.C.), Lisa Murkowski (Alaska), Rob Portman (Ohio), Mitt Romney (Utah), Patrick J. Toomey (Pa.) and Todd C. Young (Ind.), as well as McConnell, Cornyn and Tillis.

Other Senate Republicans voiced an array of misgivings about the bill, most of them arguing that the bill did not do enough to protect law-abiding Americans’ constitutional rights.

Some conservative senators filed amendments to the bill, such as an alternative from Sens. John Barrasso (R-Wyo.) and Ted Cruz (R-Tex.) that would fund school-based security officers and mental health programs while toughening enforcement of existing gun laws.

Cruz on Thursday in a lengthy floor speech lambasted provisions in the bipartisan bill “that satisfy the Democrat political priority to go after the Second Amendment right to keep and bear arms of law-abiding citizens.”

“I’m angry that these horrific crimes keep happening, but I’m also angry that this august chamber plays political games,” he said. “This bill is designed, among other things, to satiate the urge to do something. … I agree: Do something. But do something that works, do something that will stop these crimes. This bill ain’t that."

But Thursday’s Senate vote was the true breakthrough — breaking a de facto filibuster of gun-control legislation that has been in place since the mid-1990s, when bipartisan majorities passed the Brady Bill establishing the national background check system, a 10-year-ban on assault weapons and restrictions on gun sales to domestic-violence offenders.

None of the measures included in the present bill go nearly so far, however. They are best described as modest expansions and adjustments to existing laws — such as the closing of the “boyfriend loophole,” a gap in a 1996 law aimed at keeping guns away from domestic-violence offenders.

Existing law, however, bars weapons sales only to misdemeanor domestic-violence offenders who committed their crimes against a spouse or a partner with whom they had lived or had a child. The Senate bill includes those who committed misdemeanors against those in “current or recent former dating relationship” for the first time.

Another key provision creates “enhanced” background checks for gun buyers under 21, who would be subject to a search of juvenile criminal and mental health records for the first time. Authorities would have up to 10 business days to review those records under the Senate bill, though that provision is set to expire in 10 years — after which juvenile records are set to be routinely included in the federal instant background check database.

The bill also puts an additional $750 million into an existing Justice Department grant program and allows it for the first time to fund state crisis-intervention programs, including “red flag” laws that allow authorities to keep guns temporarily away from people found to represent a danger to themselves or their communities. Other provisions establish new federal gun-trafficking offenses and clarify which gun sellers are required to seek a federal firearms license and thus run background checks on their customers.

The mental-health-focused elements of the bill would allow states to create “community behavioral health centers,” ramp up in-school intervention programs and allow broader access to telehealth services for those in a mental health crisis, among other programs. The $15 billion price tag is offset by delaying a Trump administration regulation dealing with Medicare drug costs.

In an interview Thursday, Schumer noted that it was the first time in decades that the Senate had passed a measure that the NRA had opposed, calling the development “almost exhilarating.”

“We’re going to try to do more down the road, obviously,” he said. “I’m not happy until we get an assault weapons ban and a universal background check and other things as well. But for the first time the NRA was defeated on something significant.”

But any exhilaration was tempered by developments earlier in the day, just across First Street NE from the Senate chamber, that showed the staying power of the gun-rights movement.

The Senate’s vote came just hours after the Supreme Court, in a 6-3 decision, expanded Americans’ rights to publicly carry firearms under the Constitution — striking down a New York law that required those seeking a license to carry a handgun to demonstrate a legitimate reason to do so.

The court’s opinion, written by Justice Clarence Thomas, holds “that the Second and Fourteenth Amendments protect an individual’s right to carry a handgun for self-defense outside the home.” But a concurring opinion written by Justice Brett M. Kavanaugh and joined by Chief Justice John G. Roberts Jr. emphasized that the Constitution continues to allow a “variety” of gun regulations.