Martin O'Malley is a potential Democratic presidential candidate and the former mayor of Baltimore and the former governor of Maryland. (Win McNamee/Getty Images)

Former Maryland governor Martin O’Malley was heckled on a packed street corner in West Baltimore on Tuesday, after he cut short a trip to Europe to return to the city he led as mayor for seven years.

O’Malley (D), who is preparing to launch a White House bid, waded into a crowd near the burned-out shell of a CVS pharmacy that was destroyed and looted Monday night. He was confronted by two men on motorcycles who shouted expletives and blamed the recent violence in the city on O’Malley’s tough-on-crime policies from 1999 to 2007.

“I just wanted to be present. There’s a lot of pain in our city right now, a lot of people feeling very sad,” O’Malley told reporters at the scene. “Look, we’ve got to come through this together. We’re a people who’ve seen worse days, and we’ll come through this day.”

In his travels to early nominating states, O’Malley has described Baltimore to Democratic audiences as a down-on-its-luck city that came to believe in its potential again while he was mayor. He has trumpeted progress made during his tenure, including a steep drop in violent crime, which is attributed in part to a zero-tolerance approach that led to a sharp increase in arrests.

The mayhem that broke out Monday following the funeral of Freddie Gray — who died after being injured in police custody — complicates that narrative. And the unrest has given critics of O’Malley’s aggressive policing strategy a fresh platform to blame him for some of the deep-seated mistrust between the city’s police and the poor communities, more than eight years after he left the mayor’s office.

“It sure isn’t going to help him,” said Gene Raynor, a longtime O’Malley critic who was a close friend of the late Baltimore mayor and Maryland governor William Donald Schaefer (D). “I think it does reflect on him.”

During an appearance on MSNBC’s “Morning Joe” on Tuesday, former Republican National Committee chairman Michael S. Steele accused O’Malley of contributing to a poisoned atmosphere in Baltimore. Steele, a former Maryland lieutenant governor, said tensions had simmered for a long time and got worse during O’Malley’s tenure as mayor.

“You couldn’t sit on your stoop, people were harassed, and so all these tensions have been building and simmering for some time,” Steele said. “The trigger, obviously, is the death of Freddie Gray, but there’s systemic issues there.”

On the street corner Tuesday afternoon, O’Malley displayed a wide smile as he shook hands and posed for selfies with some residents. A team of aides accompanied him through the crowd, as reporters and residents questioned him about his administration’s policing policies.

“F--- that, this is his fault!” screamed a man who followed along on a red motorcycle as O’Malley and the crowd that surrounded him moved down the street. “Do you know who he is? Why would you shake his hand?”

In an interview with The Post, the man identified himself as Wayne Grady, and said he was a housing developer who has lived in Baltimore all of his 47 years. “He had his chance to fix this,” Grady said of O’Malley. “He’s part of the frustrations that are built up in these black young men.”

While he spoke briefly with reporters, O’Malley declined to discuss his record on crime and policing in detail.

“Every mayor does their very best to strike the right balance, to save as many lives as we possibly can,” O’Malley said. “What we had zero tolerance for was police misconduct. We worked at it everyday.

Asked about the heckler, O’Malley said, “Most people have been very nice to me. You’ve got to be present in the middle of the pain, man.”

It’s impossible to know what will unfold in Baltimore in coming days, and it’s too early to tell what impact the episode will ultimately have on O’Malley, already considered a long shot against fellow Democrat Hillary Rodham Clinton. But analysts said Tuesday that his list of challenges clearly has grown longer.

“You’re up against the images people are seeing today, even if you did a great job,” said Democratic strategist Joe Trippi. “It’s like talking about climate change when there’s the worst snowstorm in your city’s history. It doesn’t mean you can’t win your case, but it’s a tougher case to win.”

Others, including some activists in early nominating states, said O’Malley might have an opportunity to connect with voters if he can find a way to speak meaningfully with them on an issue that has become part of the national conversation: civilian deaths at the hands of police.

“I think it’s an opportunity for [O’Malley] to lead,” said Jim Mowrer, vice chairman of the Iowa Democratic Party, who has not yet committed to a 2016 presidential candidate.

At a minimum, the unrest in Baltimore brings O’Malley’s tenure as mayor to the forefront. Phil Noble, an O’Malley supporter in South Carolina, said he thinks voters are sophisticated enough to recognize progress made in Baltimore during O’Malley’s tenure, even if the city is going through troubling times now.

“Surely, it’s not confirmation of some Garden of Eden that’s been created in Baltimore,” Noble said. “But I think it’s a bit of a stretch to blame him for something that happened eight years later.”

Scott Brennan, the former chairman of the Iowa Democratic Party, said he thinks that’s the case as well. “Does this hurt Martin O’Malley in Iowa? No,” Brennan said.

But Matthew Crenson, a professor emeritus of political science at Johns Hopkins University, said he thinks the riots could derail O’Malley’s presidential aspirations.

The zero-tolerance strategy “created a confrontation between police and the communities they’re policing,” said Crenson, who is writing a book about the political history of Baltimore. “Young black males felt continually harassed.”

The city abandoned the zero-tolerance approach under O’Malley’s successor, Sheila Dixon (D). “But the culture is still there, the resentments are still there,” Crenson said. “And I think that may have been one factor that was operating here.”

O’Malley canceled some paid speaking engagements in Europe in order to return to Baltimore on Tuesday. He made several appearances in the city in the late afternoon, stopping at one point to pray with residents and touring the site of the East Baltimore Senior Center, which was ravaged Monday by a fire whose cause remains unknown. He also went with members of the Baltimore City Council to Old Town Mall and to a West Baltimore community meeting.

Wagner reported from Annapolis. Laura Vozzella in Richmond contributed to this report.