House lawmakers have begun debating a bill intended to tighten Massachusetts' gun laws.

The bill would require police chiefs give written reasons for denying gun licenses to individuals seeking them. Those denials would have to be based on public safety and could be appealed in court.

The bill would also create a web-based portal within the state Executive Office of Public Safety to allow for real-time background checks for private gun sales.

Penalties for some gun-based crimes would be stiffened under the bill, which would also create a firearms trafficking unit within the State Police.

The legislation seeks to improve safety at schools by requiring each district have access to two-way communication devices with police and fire departments.

The Massachusetts Gun Owners Action League, which was critical of an earlier version, is supporting the bill.