A new proposal heading toward passage in Massachusetts would give police the authority to petition courts for the right to deny someone access to shotguns and rifles if that person is deemed a threat.

Current state law allows police to unilaterally deny anyone deemed a potential threat the right to a handgun license, but a legislative compromise agreed to by lawmakers Wednesday on Beacon Hill would allow them to take action against owners of other guns used for hunting and sport, too.

House and Senate negotiators reached agreement on the compromise after civil liberties groups objected to a provision that gave police unilateral power. The Senate stripped its version of a similar provision, the Boston Globe reported.

The agreement will require police to go to court to explain why someone’s right to a license should be revoked.

The legislation, coming in response to the 2012 school shootings in Newtown, Conn., when a mentally ill man killed 26 children and teachers, would require Massachusetts to join a national database that includes criminal and mental health information. Schools would be required to develop plans for student mental health needs.

Lawmakers will adjourn for the summer today, putting extra urgency on negotiations that concluded Wednesday. The legislature, controlled by Democrats by a wide margin, is expected to pass the measure easily, and Gov. Deval Patrick (D) is expected to sign it.

Massachusetts is one of the handful of Democratic-run states that have passed tougher gun control laws in the year and a half since the Newtown shootings. About 40 laws strengthening gun control measures have passed in that time.

Republican-run states have mostly passed laws loosening restrictions on gun laws. About 70 new laws have passed in red states over the past 18 months.