After 13 years in prison for first-degree murder, a Baltimore man walked free Tuesday afternoon as the Baltimore state’s attorney’s office joined his defense team in asking for his exoneration.

State’s Attorney Marilyn Mosby formally apologized at a news conference to Lamar Johnson and his family for what her office now believes was his wrongful conviction.

The Mid-Atlantic Innocence Project, which investigates suspected wrongful convictions, began looking into Johnson’s case in 2010. Last year, the project presenting its findings to the state’s attorney’s Conviction Integrity Unit — the first of its kind in Maryland — which, after its own investigation, agreed that Johnson was innocent.

“The public must know that justice is the only barometer of success,” Mosby said.

Johnson, 34, was sentenced to life in prison in 2006 for the fatal shooting of 30-year-old Carlos Sawyer in March 2004.

Johnson first became a suspect after a police informant provided a nickname of a possible shooter, and Johnson was mistakenly identified as using the same nickname, officials said.

In its review, the state’s attorney’s office concluded that eyewitness testimony during the trial was flawed and that the two witnesses who identified Johnson as the gunman had said that he merely “looked similar” to the shooter, Mosby said. Another witness testified that another person — not Johnson — had fought with the victim minutes before his death, according to the Mid-Atlantic Innocence Project.

During the course of its six-year investigation, the organization faced many challenges in building Johnson’s case, said Parisa Dehghani-Tafti, the project’s legal director. Apart from the trouble with finding wit­nesses and the reality that memories had faded, the team struggled to overcome people’s fears about cooperating in investigations, ­Dehghani-Tafti said.

“The hardest thing was getting witnesses to talk,” she said. “It takes an extradordinary amount of courage to speak up about a crime, and maybe even more to speak up 10 years later.”

Members of Sawyer’s family have long been convinced that Johnson was innocent, but Mosby said Johnson’s release was a bittersweet moment.

“They now must face the unsettling reality that Carlos’s attacker has not yet been brought to justice,” she said.

Surrounded by family members at the news conference, Johnson described the frustration and despair he experienced in prison, but he said that with therapy and his family’s support he hoped to put the past 13 years behind him.

The moment of release from prison can be overwhelming, said Shawn Armbrust, the Mid-Atlantic Innocence Project’s executive director. While there is joy about finally getting the exoneration they’ve fought for, former prisoners like Johnson start putting together how much they’ve lost, she said.

Having secured his GED while in prison, Johnson said he hoped one day to own a franchise. He also told others who believe they are wrongfully convicted to write to the innocence project for help.

“I finally got justice,” he said.