A Maryland flag on a desk at the Maryland General Assembly. (Jonathan Newton/The Washington Post)

A panel of Maryland lawmakers reached a compromise late Saturday on a far-reaching criminal justice bill that eliminates mandatory minimum sentences for nonviolent drug offenders, increases penalties for several violent crimes and allows some nonviolent criminals to be released from prison earlier.

The measure aims to reduce the state’s prison population and costs by changing how drug offenders are sentenced, shifting the focus to treatment rather than prison.

The agreement came after nearly six hours of emotionally charged deliberations, just two days before the close of the legislative session. Lawmakers described the revised bill — which must be approved by the full House and Senate and sent to Gov. Larry Hogan for consideration — as groundbreaking.

“It tackles issues all over the criminal justice system,” said Sen. Robert A. Zirkin (D-Baltimore County).

Del. Kathleen M. Dumais (D-Montgomery), who co-chaired the conference committee with Zirkin, said the bill “could have gone, and should have gone” further. But she said she was ultimately pleased with the agreement, which the panel approved unanimously.

Earlier Saturday, the House of Delegates gave final approval to a bill designed to help close the gender pay gap for women, sending the measure to Hogan (R).

The proposal, approved in a 100-to-36 vote, would ban employers from providing lower wages or less-favorable job opportunities based on sex or gender identity as well as bar any workplace rules against discussing pay with colleagues. The governor has not taken a position on the legislation.

The House also passed a bill to reduce taxes for middle-income residents and many businesses while expanding tax credits for the working poor, setting up a final round of negotiations with the Senate, which has approved a significantly different version.

The House version of the bill would provide a modest rate reduction for middle-income taxpayers. Individual filers would save $100 on their first $100,000 of income, while joint filers would save $150 on their first $150,000.

The Senate measure would slightly increase the income-tax exemption for middle-income earners from $3,200 to $3,400 over four years and lower rates for households earning more than $150,000.

Many Democrats have objected to the latter provision, saying it would benefit the wealthiest Marylanders at the expense of state services.

Both versions of the bill would expand eligibility for the Earned Income Tax Credit, extending the benefit for the working poor to taxpayers who are 18 and older. Under existing law, the credit applies only to low-income individuals with children.

The Senate also voted 45 to 1 in favor of a bill that would make sweeping changes to how police officers are hired, trained and disciplined. With the Senate version differing from the House bill, the legislation will probably be settled on Monday.

The proposal would require officers to receive psychological evaluations after traumatic incidents; give residents more time to file brutality complaints; reduce the time given to officers accused of misconduct before they must cooperate with internal investigations; and require a new commission to develop anti-discrimination and use-of-force de-escalation training for all officers. The House and Senate disagreed over who should serve on police review boards.

The Senate gave preliminary approval to a bill that would allow dentists, podiatrists, nurse midwives and nurse practitioners to write prescriptions for medical marijuana.

Several lawmakers said they worried about whether that legislation went too far. But Zirkin said he saw it as an extension of the state’s approval of allowing medical marijuana, ensuring that all who are licensed to prescribe marijuana have the ability to do so. “We’re either going to treat it as medication or we’re not,” Zirkin said.

The final version of the nearly 100-page criminal justice reform bill would send people charged with drug possession to treatment instead of prison; eliminate disparities in penalties for offenses involving crack and powder cocaine; make it easier to have drug-possession convictions expunged; and offer drug offenders the same number of credits to reduce their sentences that are given to other nonviolent offenders.

It would also allow people who are serving mandatory minimums for drug offenses to appeal their sentences.

At the same time, it would increase the penalties for second-degree murder and kidnapping.

The biggest sticking point between the House and Senate revolved around the repeal of mandatory minimum sentences for mid- to low-level drug offenders.

The committee agreed to do away with the mandatory sentencing requirement, which disproportionately affects African American men. It replaced it with maximum sentences that a judge could give.

Under current law, the mandatory minimum for a person charged with possession with intent to distribute is 20 years. Under the proposal, a judge could give a maximum of 20 years to the defendant, but it is not mandatory.Shank called the deal “a balanced approach” that provides treatment for nonviolent drug offenders while increasing penalties for violent gangs. He said he believes Hogan will support it.

Christopher B. Shank, Hogan’s deputy chief of staff, helped the lawmakers broker the deal. Shank served with Dumais and Zirkin last year on the Justice Reinvestment Coordinating Council, whose recommendations to the legislature laid the foundation for the criminal justice reform bill.

On Saturday, when the discussion became heated, the five delegates and five senators on the conference committee twice left the conference room to huddle in private. Shank shuttled between the two meeting rooms, eventually helping the lawmakers reach agreement.