Gov. Mark Dayton signed a bill into law Monday that will allow prosecutors to arm themselves while on duty.

The legislation was drafted after a courthouse shooting nearly killed Cook County Attorney Tim Scannell last December. Under the new law, prosecutors with gun permits will be able to carry weapons during the work day.

Previously, a quirk in state law had prohibited prosecutors from carrying weapons while on duty even though no such restrictions were imposed on judges or public defenders.

During debate on the bill, lawmakers were assured that judges will retain the right to ban guns from courtrooms and courthouse grounds. Supporters of the legislation said the old restrictions prevented prosecutors from keeping guns in their cars or offices, and made it difficult to field work-related calls on their days off. Scannell was shot in his office, allegedly by a defendant he had just prosecuted.

Dayton also signed off on three bills that passed the Legislature with unanimous support: One that allows automated drug distribution in certain health-care facilities, another that establishes Medicaid reimbursement for some services provided by paramedics and a Minnesota Comprehensive Health Association policy bill.

The governor vetoed an asbestos liability bill.