On Tuesday, Maryland's legislature took a dramatic step: It gave back the right to vote to more than 40,000 Marylanders.

Specifically, the legislature overrode Republican Gov. Larry Hogan's veto to allow convicted felons currently on probation or parole to vote in Maryland. Previous law forbade people who are serving a felony sentence — whether in prison, on probation, or on parole — from voting. Now only people in prison will be barred from voting.

The law will go into effect on March 10 — in time for the 2016 primary and general elections.

"No one should be deprived of their fundamental right to vote," Penda Hair, co-director for the Advancement Project, said in a statement. "This is a momentous day for the 40,000 Marylanders who are set to regain their voice in our political process, and for all who believe in the values of inclusive democracy."

But Maryland still prohibits felons in prison from voting. And Maryland isn't alone — with the exception of Maine and Vermont, every state has some restrictions on the voting rights of people with felony records.

Most states have voting restrictions based on criminal records

Only Maine and Vermont allow everyone to vote regardless of criminal record. Most states don't let felons in prison, on parole, or on probation vote, and 10 limit at least some felons from voting after they've completed their sentences, according to the American Civil Liberties Union.

As a result, the Sentencing Project estimated in 2012 that more than 5.8 million Americans weren't legally allowed to vote due to their criminal records — more than the population of either Colorado or South Carolina. Several states prohibited 6 to 11 percent of their electorate from voting.

Since black Americans are more likely to go to prison, this had a disproportionate impact on the African-American electorate: While the overall disenfranchisement rate didn't break 11 percent for any state, the black disenfranchisement rate topped 20 percent in Florida, Virginia, and Kentucky.

This is one of the various collateral consequences of prison, which include restrictions on employment and bans on receiving welfare benefits, accessing public housing, or qualifying for student loans for higher education.

So not only does prison deprive people of their freedoms while they're incarcerated, but the punishment can follow people for the rest of their lives.

The extended punishment can sometimes make it much more difficult for ex-inmates to get benefits that would allow them to get a job or an education, which might leave them with few options but crime to make ends meet. And since black people are more likely to be affected, collateral effects may help perpetuate crime in African-American communities in particular.

Watch: Mandatory minimums helped drive mass incarceration