More than 40 years ago, Ernest Dubose shot and killed the manager of a McDonald’s in the District who had left the restaurant to make a deposit. Dubose was convicted of first-degree murder in Prince George’s County and sentenced to life in prison.

On Tuesday, Dubose, now 75, was set free.

He is one of about two dozen Maryland inmates who have been released from prison early because of a 2012 Maryland Court of Appeals decision that could ultimately mean freedom for about 200 felons who haven’t finished serving their sentences.

Dubose and others are having their cases reconsidered because the Court of Appeals, the state’s high court, determined that in cases tried before 1980, Maryland judges gave juries bad instructions, resulting in unfair trials.

The decision is forcing prosecutors to revisit decades-old cases, mostly murders and rapes. Rather than risk an acquittal on retrial — fading memories of witnesses and lost evidence would make it difficult to take the cases before a jury — prosecutors in some of the earlier cases have negotiated deals that allow the felons to be released on probation.

That was the situation with Dubose and Francis M. Jones, 68, a convicted armed robber who also was released and reunited with his family Tuesday. A Prince George’s judge approved deals between prosecutors and the state public defender’s office in both cases.

“We believe that the cause for fundamental fairness requires that we would concede that the court made a mistake in both of these cases,” Prince George’s County State’s Attorney Angela D. Alsobrooks said.

Most of the cases affected are in Baltimore, but Alsobrooks said her office knows of 19 in Prince George’s. About a half-dozen felons are expected to bring similar claims in Montgomery County, lawyers said, including a man who kidnapped and raped a 13-year-old girl.

John Maloney, a deputy state’s attorney in Montgomery, said prosecutors there are preparing to put up a fight in cases if they think the inmates need to remain behind bars — based on the severity of the crimes or the potential danger posed by an inmate.

Maloney said that prosecutors will weigh other factors as well, including the strength of the case at the original trial, the strength of the evidence the state could produce now and the inmate’s behavior behind bars.

“We take these cases very seriously,” Maloney said. “We’ll make a thorough analysis of each case.”

The high court ruling came in the case of Merle Unger Jr. Unger was sentenced to life in prison for shooting and killing a Hagerstown police officer who interrupted a holdup in 1975.

During Unger’s trial, the judge told jurors that his instructions about the law were “merely advisory.” The Court of Appeals ruled that those instructions would have allowed the jury to disregard Unger’s rights — to find him guilty without proof beyond a reasonable doubt and ignore the presumption of innocence.

Unger was retried and convicted again, and sentencing is scheduled for October.

Prosecutors and defense lawyers said the criminals affected by the ruling have served decades in prison.

Brian M. Saccenti, the chief attorney for the appellate division of the Maryland Office of the Public Defender, said many of the convicts have worked behind bars to better themselves.

“All of the people we have represented who have been released are people who have done a lot of very positive things while incarcerated,” Saccenti said “In many cases, they have become really good men.”

Dubose, who spent 41 years in prison, received an associate’s degree while he was an inmate and tutored other inmates in math, his attorneys said.

As Dubose was released from a prison van outside the Prince George’s County courthouse Tuesday afternoon, he ran in the direction away from his family to avoid the media. He later hugged relatives in a nearby parking lot.

“It feels good,” said Michelle Melson, Dubose’s 46-year-old daughter. “I’m glad this day has come.”

Alsobrooks said the state had to weigh some complicated circumstances in coming to an agreement in Dubose’s case.

“I’m sure for the defendant and his family, there’s a sense of relief, but for us, we always have to remember the reality that someone was murdered,” Alsobrooks said. But because the prisoners received trials in which the juries didn’t receive proper instructions, she said, “we have the opportunity to remedy that mistake.”

In all such cases, prosecutors said, the state tries to contact the victims or their families.

Prosecutors said they were unable to reach relatives of James Smith Jr., the McDonald’s manager slain by Dubose.

In Jones’s case, two of the three victims contacted by the state said Jones should be released. The third thought that “justice should be done” but didn’t specify what that would be, said Assistant State’s Attorney Karen Polis.

“As far as the victims are concerned, I’m very apologetic,” Jones said in court Tuesday. But “I thank the judge for granting me this opportunity.”

Jones, a repeat offender, was sentenced to life without parole for robbing a grocery store when his now-47-year-old daughter Elizabeth Weaver was just a child.

Weaver, who was reunited with her father Tuesday, said she remembered seeing him only twice during the 32 years of his incarceration.

“I’m happy he’s free,” Weaver said. “We’re ready for him to get on with the rest of his life and live it to the fullest with the time he has left.”

Prince George’s prosecutors said they also are trying to reach a deal with convicted murderer Ralph Edward Wilkins, who they said had escaped from prison and avoided serving 17 years of his sentence.

Alsobrooks said the agreement would require that Wilkins serve additional time before being released. If a deal doesn’t work out, she said, the state is prepared to retry Wilkins.

Of the inmates who have been released, she said, “we believe they no longer pose a threat to our community.”

Because they have been removed from society for so long, relatives worry about how Dubose and Jones will adjust to life outside prison.

“I’m worried about him being integrated into society,” Weaver said of Jones, who will live with his sister. “We’re going to see him out in a world he doesn’t know any more.”

Jennifer Jenkins contributed to this report.