On Wednesday, Beacon Hill experienced a surreal day. In a country where gun-control proposals usually provoke a harsh backlash from uncompromising gun-rights advocates, the Massachusetts House passed legislation to tighten up the state’s already tough gun laws, and it was praised by both gun control advocates and gun rights lobbyists. With the vote, the state has turned itself into a leader when it comes to bridging what often seems like an intractable gulf between the two sides.

“Overall, I’m thrilled,” said John Rosenthal, head of Stop Handgun Violence and the creator of the Massachusetts Turnpike billboard that currently estimates 50,000 Americans have died from gun violence since the Newtown, Conn., elementary school massacre in 2012. “It’s the first time in a long time where everyone could be heard.”

Concurring was the organization one might least expect, the Gun Owners Action League. The state affiliate of the National Rifle Association called the bill “a great victory for Second Amendment advocates in Massachusetts.”

GOAL won several changes to the original legislation, including the requirement that police chiefs who deny a gun permit explain why in writing and that state suicide data collection include all forms of suicides, not just those from firearms. Another change allows private firearms sales to be made via a state online portal rather than forcing buyers and sellers to complete the transaction at a licensed dealer.

GOAL Executive Director Jim Wallace was not as “thrilled” with the bill as Rosenthal, but the fact that his group officially declared itself neutral on the bill was a testament that gun owners felt heard. “The original bill placed too much of a burden on purchasers to prove suitability,” Wallace said. “The legislation is now better at placing the burden on chiefs to prove purchasers are unsuitable.”

That represents as close to a truce as you can get in the gun control wars, making it all the more urgent for the Senate to pass the bill before the end of the legislative session July 31. Despite the compromises (which include the omission of Governor Patrick’s longstanding proposal to limit gun sales to one a month), national gun control groups largely hailed the legislation. It passed on the day that a mass shooting near Houston claimed the lives of four children.

Laura Cutilletta, senior staff attorney for the San Francisco-based Law Center to Prevent Gun Violence, called the bill “very strong,” particularly in the area of police chief discretion and the online portal for private sales. If the portal works, she said, Massachusetts would become only the seventh state to close the loophole on unlicensed sellers.

Brian Malte, policy director for the Brady Campaign, was skeptical of whether an online portal would be as effective in helping law enforcement track down weapons used in crimes as would a paper record from a licensed dealer, but otherwise said the bill advances Massachusetts’ efforts to keep guns out of the hands of dangerous people. He was particularly impressed with the bill’s emphasis on suicide awareness and prevention training.

“We can have all the laws we want, but we also have to change the social norms,” Malte said. “There are still 300 million guns out there, and lots of them are loaded and unlocked. The last thing you want if you’re trying to prevent suicide is a teenager in a home with unlocked weapons.”

About the only major naysayer was the NRA. It said in a statement that the discretion of police chiefs, though adjusted by GOAL, was “egregious.” The organization warned that “a government official with a personal grudge” could concoct any excuse to deny a permit.

Fortunately, for a moment at least, the national NRA’s voice is muted because local gun-rights advocates did not treat the bill as a grudge match. Malte said he could not recall such a respectful debate in any other state that has tightened its laws. That is obviously a credit to House Speaker Robert DeLeo, who built on the state’s strong record on gun control to craft even more sophisticated legislation.

“In all the other states,” Malte said, “there was support, opposition, and nothing in between.” The Senate should appreciate that when it takes up the bill. Massachusetts has just become a national model for getting gun control and gun rights advocates close enough to the same page to produce sane legislation, in a nation where the overall debate remains paralyzed.