Jose Antonio Vargas, left, and former Maryland governor Martin O’Malley, right, listen to Tia Oso, the national coordinator for the Black Immigration Network, during the Netroots Nation conference. (Charlie Leight/Getty Images)

A forum featuring two of the most liberal candidates for the Democratic presidential nomination was disrupted and taken over Saturday by liberal activists seeking to showcase their concerns for the plight of African Americans.

Former Maryland governor Martin O’Malley and Sen. Bernie Sanders (I-Vt.) made back-to-back appearances in a presidential town hall that was part of the four-day Netroots Nation conference here, an annual gathering of 3,000 progressive activists that Democratic front-runner Hillary Rodham Clinton elected to skip.

Shortly into O’Malley’s allotted time, his discussion with a moderator was disrupted by more than 100 protesters that included members of Black Lives Matter, a group formed after teenager Trayvon Martin’s shooting in Florida, and the Black Alliance for Just Immigration.

As chanting protesters streamed to the front of the room, O’Malley looked stunned at first and then started clapping along.

Former Maryland Gov. Martin O'Malley is a Democratic contender for the White House in 2016. Here's his take on gay marriage, income inequality and more, in his own words. (Julie Percha/The Washington Post)

Close to 10 minutes later, leaders of the protest were handed microphones and rattled off a number of their concerns, including deaths of African Americans in police custody, and demanded specific solutions from O’Malley.

“It’s not like we like shutting s--- down, but we have to,” Patrisse Cullors, co-founder of Black Lives Matters, told the crowd, saying the group’s issues were an emergency.

The protest, however, did not appear aimed at O’Malley. The protesters remained as Sanders appeared on stage, and he took a less patient approach.

“Whoa, whoa, let me talk about what I came to talk about for a minute,” the senator said before launching into a riff on income inequality and steps to address it.

The Vermont senator faced chants and heckling as well, but Sanders continued talking. Asked what he had done in the Senate to benefit black Americans, he started to talk about the 2010 Affordable Care Act.

“We can’t afford that!” heckled Elle Hearns, a 28-year-old Ohio-based coordinator for the LGBT rights group GetEqual.

O’Malley made several starts at addressing the issues raised but was interrupted.

Democratic presidential candidate and former Maryland governor Martin O’Malley speaks to guests at the Iowa Democratic Party’s Hall of Fame Dinner on Friday.

“I think that all of us as Americans have a responsibility to recognize the pain and grief throughout our country from all of the lives that have been lost to violence, whether that’s violence at the hands of police, whether that’s violence at the hands of civilians,” he said.

“Stop trying to generalize this s---!” yelled Ashley Yates, a 30-year-old activist from Oakland, Calif.

Later, O’Malley drew boos as he said: “Black lives matter. White lives matter. All lives matter.”

After his appearance, O’Malley addressed those comments on a radio show being recorded at the convention hall.

“When I said those other two phrases, I meant no disrespect,” O’Malley told the online radio show “This Week in Blackness.” “I did not mean to be insensitive in any way.”

As Baltimore’s mayor, O’Malley faced criticism of the city’s aggressive policing policies, a topic that moderator Jose Antonio Vargas questioned him about at the outset of the forum. (Vargas, a journalist, filmmaker and activist who is an immigrant in the country illegally, previously worked as a reporter for The Washington Post.)

Sanders made several comments addressing the protesters’ concerns, including: “In my view, maybe, just maybe, it’s time to invest in jobs and education, not in jails and in incarceration.”

That generated applause from a crowd where hundreds carried Sanders’s campaign signs.

Vargas decided to cut the forum about 15 minutes short of its allotted time.

“Unfortunately, we have to wrap it up,” he said.

“Okay, good,” Sanders replied, before rising to exit.

Following the event, Mary Rickles, a spokeswoman for Netroots Nation, said: “We wish the candidates had more time to respond to the issues. What happened today is reflective of an urgent moment that America is facing today.”

The crowd was largely sympathetic to the protesters, but many said afterward that they wish they could have heard more from the candidates.

“I didn’t disagree with the message,” said Elizabeth Arledge, 50, of Alexandria, Va., an activist who focuses on civil justice. “I was very supportive of it, and I also wanted the program to go on.”

Lucas Hernon, 30, of Las Cruces, N.M., an undecided voter, said he thought O’Malley handled the situation well except for when he said white lives also matter. “As a white person, we don’t need to be reminded of that,” Hernon said.

Some in the audience suggested there could be fallout from the event for Sanders, whose challenges include expanding his appeal beyond liberal white voters.

Bethany Winkels, a 30-year-old activist from Minneapolis, said it was hypocritical for Sanders to call for more grass-roots organizing in one breath and then sound dismissive of the protesters in the next.

“It’s shameful, and he needs to do better,” Winkels said.

James Hohmann contributed to this report.