Democratic presidential candidates Martin O’Malley and Bernie Sanders faced hecklers Saturday in the annual Netroots Nation convention in Phoenix as they tried to impress some of the party’s most influential activists.

As O’Malley was being interviewed on stage, demonstrators protesting cases of police brutality and the treatment of black Americans by law enforcement interrupted the setting.

The protesters stormed the convention hall chanting, “Black lives matter!” As O’Malley and interviewer Jose Antonio Vargas looked on, one of the group’s leaders took the stage and addressed the audience as a largely female group of demonstrators railed against police-involved shootings, the treatment of immigrants and Arizona’s racial history.

Before departing the stage, O’Malley told the convention: "Black lives matter. White lives matter. All lives matter," prompting some heckles and boos in the crowd.

O’Malley was immediately met with scrutiny and apologized for his comments.

"I meant no insensitivity by that and I apologize if that's what I communicated," he told reporters at an immigration event. "That was misstated. What I intended to say was that we're all in this together — that black lives do matter and we have a double-standard of justice in this country."

Sanders was met with heckling and protesters from the crowd as well as he tried to address the 3,000 Netroots activists. At one point, Sanders said: "Black lives of course matter. I spent 50 years of my life fighting for civil rights and if you don't want me to be here, that's OK."

During an abbreviated 20-minute appearance, the self-described democratic socialist from Vermont spoke about the need to address wealth and income inequality, noting that blacks and Hispanics face high rates of unemployment. Sanders was scheduled to meet with representatives of the organization Black Lives Matter after the speech, but his campaign manager, Jeff Weaver, attended the meeting instead, spokesman Michael Briggs said.

Sanders later addressed police brutality at a rally Saturday night, telling a crowd of more than 11,000 it is unacceptable for young black men to be beaten and killed while walking down the street.

"When a police officer breaks the law, that officer must be held accountable," Sanders said. He later quoted the 19th century black abolitionist Frederick Douglass: "Freedom doesn't come without struggle."

Both Sanders and O’Malley are considered to be longshots for the Democratic nomination behind Hillary Clinton. Clinton was not in Arizona Saturday, who instead decided to campaign in Iowa and Arkansas.

The response at the forum to both candidates shows that all Democratic candidates have work to do to understand the black lives movement, according to MoveOn.org executive director Anna Galland said.

"Saying that 'all lives matter' or 'white lives matter' immediately after saying 'black lives matter' minimizes and draws attention away from the specific, distinct ways in which black lives have been devalued by our society," Galland said.

She added that while issues of economic and racial justice intersect, "portrayals of racial injustice as merely an offshoot of economic injustice or the implication that solutions to economic inequality will take care of racism represent a fundamental misunderstanding of how race operates in our country."

The demonstrators were promoting the national “Black Lives Matter” movement, which seeks changes to police policies following high profile deaths of black men at the hands of law enforcement officers.

Before the demonstrations, Vargas pressed O'Malley to defend his law enforcement record as Baltimore's mayor a decade ago. O'Malley faced scrutiny when unrest broke out in his home city after an African-American man, Freddie Gray, died while in police custody in April.

O'Malley discussed his work to deal with violence and drug addiction in Baltimore, telling the crowd, "there are very few issues in our country that are quite as painfully intertwined as the legacy of violence, race and law enforcement in America." He said his policies improved policing, reduced the number of police-involved shootings and increased drug treatment.

The Netroots Nation convention has been a rough place for presidential candidates before. Clinton last appeared in 2007, when it was called the Yearly Kos, and heard boos from some activists who disapproved of her vote for the 2003 invasion of Iraq and her acceptance of campaign contributions from lobbyists.

Clinton spoke up for raising the minimum raise during a dinner for state Democrats Saturday night in North Little Rock, Arkansas.

"Don't forget, voters did come out and pass an increase in the minimum wage," said Clinton, referring to the vote raising the minimum wage to $8.50 an hour by 2017. "Arkansas voters know paychecks need to grow, they know the economy is still stacked for those at the top. We just have to offer a plan for more growth and more fairness they can believe in and vote for."

The Associated Press contributed to this report.