When he heard a fellow Democrat was working against his bill to change Virginia’s sentencing laws, state Sen. Joseph D. Morrissey of Richmond sent a text message invoking his high school wrestling career.

Morrissey told Michael Mullin, a prosecutor from Hampton, Va., and chairman of a powerful House panel on criminal justice, that in 1974 he had won a state wrestling championship with a torn anterior cruciate ligament, participating against the advice of his physician father.

“You have badly underestimated me,” he concluded in the text last week. “Good luck in your primary.” In fact, he added, he had already spoken to two other Democratic senators about helping challenge Mullin next year.

On the Senate floor, Minority Leader Thomas K. Norment Jr. (R-James City) called Morrissey’s hardball tactics “putrid.”

Mullin shrugged off the back-and-forth with Morrissey as “inside baseball.” He said he never tried to kill the bill, which would allow defendants convicted in a jury trial to be sentenced by a judge, but was concerned about how to pay for it. Mullin ultimately supported the legislation and called it “revolutionary.”

Some Democrats said Morrissey’s hectoring was counterproductive; it was likely a financial commitment from Gov. Ralph Northam (D) that changed the tide.

“This bill passed on its merits, period,” said Del. Mark D. Sickles (D-Fairfax). “That was an unneeded distraction.”

But the dispute between the two lawmakers illustrates the painful infighting to the end as some Democratic leaders pushed to undo a centuries-old practice that Virginia shares only with Kentucky, while others resisted. And that Morrissey succeeded is a remarkable turn for a lawmaker who a few years ago was a national punchline and a local political pariah.

The change sounds technical — it allows someone who has gone to trial with a jury to be sentenced by a judge. But Morrissey and other advocates say the effect will be transformational, because juries, which have less flexibility than judges in crafting sentences, tend to hand out stiffer punishments than those called for by guidelines. While judges can reduce a jury sentence, they rarely do.

Juries are not told sentencing guidelines, only the legal range. They also must impose mandatory minimums, while judges can suspend them. So the threat of jury sentencing pressures people to forgo their trial rights and accept unfavorable plea deals from prosecutors.

“I have put in bills before to allow juries to see the sentencing guidelines but was laughed out of committee rooms,” said state Sen. William M. Stanley Jr. (R-Franklin), Morrissey’s personal lawyer and a longtime friend, and the only Republican senator to vote for the bill. “For Joe to have fought so hard for this on both sides of the aisle and in both chambers is remarkable. . . . He’s a legislative force to be reckoned with. People had just better recognize that now and deal with it.”

State Sen. Mark D. Obenshain (R-Rockingham) led the opposition to the bill in a long Senate debate. He said the measure will increase the number of jury trials, which, in turn, will cost the state money for more circuit court judges and clerks, prosecutors, public defenders and jurors. No money for that was included in the state budget, so Obenshain said the effect would be a delay in hearing civil cases, since criminal proceedings generally take precedence on the court docket.

“Real people across Virginia are going to bear the burden of this. Let’s just wait,” Obenshain said. “If budget writers can find the money, then by God, do it. But don’t do it this way.”

After the Senate passed the bill, the House seemed poised to reject it on fiscal grounds until Northam phoned House Appropriations Chairman Luke E. Torian (D-Prince William) minutes ahead of the vote with a funding plan, using $6 million set aside for a failed effort to expand expungement of criminal records. Torian, who had been firmly opposed, announced the offer on the floor and encouraged his colleagues to vote for it.

Defenders of the legislation argued that any financial burden would be minimal, because jury trials are rare elsewhere, and ultimately offset because fewer people would be serving time. In the federal system and across the country, fewer than 5 percent of defendants go to trial, even though outside Virginia and Kentucky, judge sentencing is the norm.

“I don’t think you’ll see all these trials all of a sudden; I think you’ll see fairer resolutions,” said Michael Hollingsworth, a defense attorney who practices across Northern Virginia. He says he often has clients with legitimate challenges to the evidence against them who nonetheless plead guilty because of jury sentencing.

“It really takes a lot of guts to roll the dice when you have such a disparity in the minimum incarceration,” he said. “A lot of folks are just not willing to take that risk even if they should.”

The change would not apply to capital cases. And defendants can still choose jury sentencing.

Some activists, while pleased, are less sanguine, saying Virginia has much further to go.

“This is something that should have been taken care of . . . in the 1960s,” said Johanna Gusman, a human rights lawyer with the NAACP of Loudoun. “This cannot define what counts as criminal justice reform in Virginia.”

Along with the expungement bill, legislation to end qualified immunity for police officers died in committee, and there was no targeted effort to release prisoners during the coronavirus pandemic.

But Morrissey and others argued that this legislation, which still requires Northam’s signature, would have the broadest impact of all the measures put forward this year.

“I’ve seen every side,” said Morrissey, 63, who has been a prosecutor, a defense attorney and a criminal. Five years ago, Morrissey lost his law license and resigned his House seat after going to jail for having a sexual relationship with his 17-year-old receptionist, Myrna Warren. He successfully ran for reelection from jail, reporting to the Capitol each day on work release. But he later dropped out of a state Senate primary and then finished third in an election for mayor of Richmond.

Last year, he staged a comeback, knocking out an establishment Democrat in a state Senate primary largely thanks to his record as a fighter for civil rights. Democrats in the closely divided Senate were forced to embrace him, and Republicans, seeing the maverick as a potential swing vote, treaded lightly.

As he saw the votes roll in on the night of Oct. 16, he was texting updates to Warren, now his wife and the mother of his three youngest children. He said he long ago got over any angst regarding their relationship; he is only satisfied to see the bill pass. But, he said, it was “bonkers” to have both Democrats and Republicans shaking his hand to congratulate him, less than a year after his acrimonious return to the legislature.

“It was a roller coaster,” he said of the bill’s passage. “That was enormously gratifying.”

An earlier version of this story incorrectly reported that Morrissey finished third in a primary for Richmond mayor. He finished third in a general election.