Martin O'Malley is testing the notion that there's no such thing as bad publicity.

The former Maryland governor has faced both in-person heckling and media criticism in the past couple of weeks. Detractors say the zero-tolerance policies he pursued as mayor of Baltimore contributed to distrust between residents and police, and ultimately the recent unrest there.

Appearing on NBC's "Meet the Press" last Sunday, O'Malley defended his record on crime, taking credit for lowering Maryland's rates of violent crime, recidivism and incarceration. He also argued the nation hasn't had a coherent urban strategy since the presidency of Jimmy Carter. He pledged to make such issues central to his own, as-yet-unannounced campaign for the Democratic presidential nomination.

"We need an agenda for American cities," O'Malley said. "We need to stop ignoring, especially, people of color and acting like they're disposable citizens in this nation."

Having his city erupt into protest and violence isn't the reason O'Malley would have chosen to appear in the national spotlight, but he hasn't done so well hustling in the early primary states. As a national candidate, he's always been a longshot.

"The bad news is that the country is paying attention to O'Malley and policing in Baltimore because now that's a negative issue," said Thomas Schaller, chairman of the political science department at the University of Maryland, Baltimore County. But the good news is that O'Malley's "name is in the news now in a way that never would have happened otherwise."

O'Malley, who Governing named a "Public Official of the Year" in 2009, was term-limited out of office this past January. In his eight years as governor, he successfully championed many pieces of liberal legislation, including same-sex marriage rights and the abolition of the death penalty. He also provided in-state tuition for undocumented students and decriminalized marijuana. The governor achieved the $10.10 hourly minimum wage that President Obama promoted. (O'Malley is now calling for $15.) And after the Newtown school shooting, Maryland was one of a handful of blue states to enact gun-control legislation, banning 45 types of semiautomatic rifles.

"It was like he had a checklist, marking off a bunch of liberal priorities," said Matthew Crenson, a retired political scientist at Johns Hopkins University.

In terms of finances, O'Malley raised the state's income tax on top earners and gas taxes, devoting substantial funding to transit. He inherited a deficit of $1.7 billion and increased spending significantly on both K-12 and higher education.

O'Malley could push a progressive agenda in a state that's among the nation's most Democratic. (The party enjoys a 2-to-1 edge over Republicans among registered voters in the state.) And he wasn't afraid to seek direct voter approval for his ideas, putting same-sex marriage, in-state tuition rates for so-called "Dreamers" and an expansion of gambling all on the ballot in 2012 alone. But Republicans counter that O'Malley went too far, even for Maryland.

Gov. Martin O'Malley speaks during a rally to increase Maryland's minimum wage to $10.10 an hour, which the state eventually did. (AP/Jose Luis Magana)

Last fall, the current GOP governor, Larry Hogan, beat O'Malley's lieutenant governor, Anthony Brown, in part by portraying their time in power as an era of unbridled tax-and-spend policies. Hogan complained that a stormwater management fee amounted to a "tax on rain." Not only did Hogan win, but the GOP made inroads in the legislature.

"O'Malley's legacy is the strongest Republican Party since the 1920s," Joe Cluster, the executive director of the Maryland GOP, told the Baltimore Sun as the governor was leaving office.

O'Malley's liberal record stands in contrast to the more moderate image he'd brought with him to Annapolis. He was known in his Baltimore days for expanding the use of data in measuring government performance, through the CitiStat program. He'd also been involved in the centrist Democratic Leadership Council.

Back in 2007, O'Malley was an early endorser of Hillary Clinton over Barack Obama. Now, he's seeking room to Clinton's left.

"His image as governor was much different from how he was as mayor," said Crenson, the Johns Hopkins professor. "As mayor, he was a hard-line, anti-crime politician."