BOSTON — The Massachusetts House approved a sweeping bill Wednesday designed to tighten the state’s gun laws.

The bill, which passed on a 112-38 vote, would strengthen local police chiefs’ discretion over issuing firearms identification cards needed for the purchase of rifles or shotguns, much like the discretion they currently have over issuing licenses to carry concealed weapons.

among the changes The gun legislation would, among other things: • Give police chiefs discretion over issuing firearms identification cards needed for the purchase of rifles or shotguns; • Require police chiefs to give written reasons for denying gun licenses, which could be used by prospective gun owners to appeal the denial in court; • Create a Web-based portal within the state Executive Office of Public Safety to allow for real-time background checks in private gun sales; • Require that Massachusetts join the National Instant Background Check System and transmit information, including any substance abuse or mental health commitments, to a federal database for use by police in reviewing firearms applications; • Create a firearms trafficking unit within the Massachusetts State Police.

The bill would require police chiefs to give written reasons for denying gun licenses, however. Their decisions would have to be based on public safety and could be appealed in court.

The measure would also create a Web-based portal within the state Executive Office of Public Safety to allow for real-time background checks in private gun sales and would stiffen penalties for some gun-based crimes. In addition, it would create a firearms trafficking unit within the State Police.

The bill now heads to the Massachusetts Senate. Supporters hope to win final passage in both branches and get the legislation to Gov. Deval Patrick before the formal legislative session ends July 31.

Jim Wallace, head of the Massachusetts Gun Owners Action League, said the group supports the changes in the bill related to gun owners, particularly the requirement that police chiefs state in writing their reasons for denying licenses.

“Now the burden is on the chief to prove us suitable rather than us proving ourselves suitable and that’s a big difference in court,” Wallace said.

John Rosenthal of the group Stop Handgun Violence said he was thrilled with the bill.

“This is a huge win,” Rosenthal said, pointing to the portion of the bill giving police chiefs more authority over issuing firearms identification cards needed for the purchase of rifles.

Rosenthal said he also supports the portion of the bill requiring Massachusetts to join the National Instant Background Check System and transmit information, including any substance abuse or mental health commitments, to a federal database for use by police in reviewing firearms applications.

Nothing in the bill would create a gun registry, but the bill would require gun owners, when they renew their licenses, to state that to the best of their knowledge they have not had any guns lost or stolen from their possession since their last license renewal.

House Speaker Robert DeLeo, D-Winthrop, called the bill “historic.”

The bill also seeks to improve safety at schools by requiring each district to develop plans to address the mental health needs of students and faculty and to have access to two-way communication devices with police and fire departments for use during emergencies. Districts would be required to have a school resource officer to provide law enforcement and security services on campuses.

Work on the bill began last year after the 2012 school shooting in Newtown, Connecticut.

Send questions/comments to the editors.