ANNAPOLIS, Md. — Maryland senators voted Monday night for a measure with tougher sentences for repeat violent offenders and sustained funding for programs aimed at reducing crime.

The bill passed 36-8 Monday night. It combines other bills and elements of proposals made by Republican Gov. Larry Hogan and requests by Baltimore Mayor Catherine Pugh. It now goes to the House.

“Violent criminals who perpetuate terror in our neighborhoods need to be held accountable,” Pugh said in a statement Monday night. “This bill strengthens the hand of justice in dealing with repeat violent offenders and drug traffickers while giving additional resources for witness protection.”

The measure is partly a response to rising crime in Baltimore, which had 342 murders in 2017 and set a record for homicides on a per-capita basis, but supporters note that the bill aims to cut crime statewide.

“There is a lot in this bill that is focused on violent crime and repeat violent crime,” said Sen. Robert Zirkin, a Baltimore County Democrat who chairs the Senate Judicial Proceedings Committee.

The measure includes roughly $40 million over four years for programs and initiatives. Sen. Bill Ferguson, a Baltimore Democrat, noted the mixed approach the measure takes to reduce crime.

“We have got to get a handle on crime in the city, and it has to be a comprehensive approach,” Ferguson said.

All eight opponents were Democrats, including four who represent Baltimore. Sen. Nathaniel McFadden, one of the four Baltimore senators who opposed the bill, said he was concerned about some of the enhanced sentences.

“Let’s see how the House addresses it,” McFadden said. “I really do want to support it and see how it looks when it comes back.”

One provision increases the sentence for a second offense of possessing a gun while committing a crime from 20 to 40 years.

The bill includes $14.4 million over four years for the Safe Streets program in Baltimore, an initiative that uses mediators to steer young adults away from violence.