The reversal both dealt a political blow to the Republican governor, who lobbied to prevent the bill from becoming law, and set the stage for an estimated 20,000 former inmates to cast ballots in Baltimore's primary election for mayor and City Council this spring.

The issue drew passionate debate from both sides on the proper message to send former inmates rejoining society.

The bill was the sixth that Hogan vetoed from last year's General Assembly, and the sixth the Democratic-controlled legislature reinstated this year. The House of Delegates voted to override Hogan's veto last month, and on Tuesday, the Senate voted 29-18 to overrule the governor.

The vote, twice delayed in order to muster enough support, followed an expansive debate that touched on resolving racial disparities in the criminal justice system and protecting victims of violent crime. The current system requires felons to complete probation and parole before registering to vote. But proponents argued that the system is confusing, unnecessary and demoralizing to ex-offenders trying to rebuild their lives.

Opponents of the law, which will go into effect March 10, said felons should earn back the right to vote only after completing their sentences.

Minutes after the override vote, convicted felon Marcus Toles of West Baltimore celebrated in the marble hallway outside the Senate chamber.

"I am overwhelmed with joy," said Toles, 27, clutching a Maryland voter registration application. "I can finally have my voice heard after doing my time and trying to be a productive member of society."

Toles said he was released from prison three months ago after serving a five-year sentence for a felony drug conviction. He is on parole until November, which under current law would make him ineligible to vote for the city's next mayor or the next president. Now that he can vote in the April 26 primary and Nov. 8 general, Toles said, he's "going to vote in every election I can."

"We've done our time, you take our taxes," Toles said of felons. "It's hard enough we get every door slammed in our faces. We paid our debt to society. We're out here striving not to go back, and you want to take our right to vote? I think our voices should be heard."

When Hogan vetoed the law last spring, he said it improperly restored rights to people who had not yet paid their debt to society. Since last month, he waged an aggressive social media campaign urging his supporters to lobby lawmakers to side with him and his "common sense" veto.

The governor responded to the vote on his Facebook page Tuesday afternoon, characterizing the override as a consequence of "partisan" politics and an exercise of Democrats' power.

"Only a tiny, radical minority supports this idea. But they did it anyway," Hogan wrote. "They don't seem to care what most Marylanders want. Why did they do it anyway? Because they can."

After the vote, while having lunch at Chick & Ruth's Delly in Annapolis with Lt. Gov. Boyd Rutherford, Hogan said lawmakers who voted for the override had made a big mistake.

"Some people may have ended their careers," he said. "Basically, they just ignored the will of the people. That's not a good way to keep your job in the Senate. ... Most Marylanders are going to be pretty upset."

Sen. Joanne C. Benson, a Democrat from Prince George's County, said she was hospitalized Monday night after a fall but came to Annapolis on Tuesday to help override the veto. She noted that the vast majority of people affected by the law are, like her, African-American.

"It's unfair," she said. "The whole system is unfair."

Baltimore Sen. Joan Carter Conway sponsored the bill and argued that it was "the right thing to do."

In a largely party-line vote, Republicans in the Senate followed Hogan's argument and said felons should be allowed to vote only after they have completed all of the terms of their sentences.

"That poor victim could be laid up in the hospital bed, and you're going off to vote," Republican Sen. Michael J. Hough of Frederick County said. "We need to have an orderly process."

Giving felons access to housing and helping them find jobs are critical to their success, Hough said, and allowing them to regain voting rights sooner gets in the way of a more "holistic" look at helping former offenders.

Four Democrats from conservative districts joined the Senate's 14 Republicans in voting to uphold the veto: Sens. James Brochin and Katherine Klausmeier of Baltimore County; Ed DeGrange of Anne Arundel County and James N. Mathias Jr. of the Eastern Shore.

The House of Delegates voted 85-56 to override Hogan's veto last month, garnering the minimum amount of support needed to reverse Hogan's action. A three-fifths vote of both chambers of the General Assembly is required to overturn a governor's veto.

Controversy preceded the vote in the Senate, where a newly appointed senator was poised to take a second vote on the override.

Sen. Craig Zucker, a Democrat from Montgomery County, voted in the House last month to overturn the veto. Late last week, he was appointed to fill a vacancy in the Senate, giving proponents of the law the 29th vote they needed in that chamber.

Republicans questioned whether it was legal for Zucker to vote on the same measure twice. An assistant attorney general advised lawmakers it was, and GOP members publicly urged Zucker to recuse himself. He did not.

The vote also brought about an hour of intrigue on the Senate floor when one lawmaker left his seat during the final vote. The override initially failed, 28-18, but under Senate rules a vote can be reconsidered. The override passed the second time around.

Senate President Thomas V. Mike Miller, a Calvert County Democrat, said the country has a long history of slowly expanding the right to vote -- to people who aren't landowners, to minorities, and to women.

"It's been a challenge for people to earn the right to vote, and to take it away, it really has to be something that is unforgiven, heinous," Miller said. "What this means here is that people who have returned to society, repaid their debt to society, they're back in society, we want to reincorporate them into society. ... We want them to be able to hold their head high, and that's what this is all about."

The Maryland Board of Elections requires eligible voters to register by April 5 to get their names on the rolls in time to cast a ballot in the primary. Advocates hope the roughly 20,000 newly eligible voters in Baltimore change the tenor of the mayoral campaign.

Jane Henderson, executive director of Communities United, said her group has been working with people in Baltimore's public housing complexes, "where every other person has a felony conviction."

"Issues facing returning citizens do not get their due from any politician because they are not considered part of the electorate and so many of them don't vote even once they get their voting rights restored," she said.

Henderson said Tuesday's vote will launch a new marathon for her. Once the law takes effect next month, "we have a month to register as many people as we can."