PHOENIX — A group of protesters repeatedly confronted Senator Bernie Sanders of Vermont and former Gov. Martin O’Malley of Maryland during a town hall discussion with liberal activists here on Saturday, demanding the Democratic presidential candidates address issues like discrimination and police brutality.

Chanting, “What side are you on, my people, what side are you on?” and “Black lives matter,” the demonstrators moved to the front of the ballroom about 20 minutes into the event as Mr. O’Malley discussed proposed changes to Social Security. They remained there, heckling the candidates and posing questions, until organizers shut down the event, one of the centerpieces of the annual Netroots Nation conference.

The protesters included members of the Black Alliance for Just Immigration and GetEqual, as well as Patrisse Cullors, a founder of the Black Lives Matter movement. A representative of the demonstrators took the stage to inform the event’s audience of what was happening, specifically that they were seeking policy proposals from the candidates on racial issues.

Mr. O’Malley repeatedly tried to answer the demonstrators, saying that, as president, he would advocate for civilian review boards and other measures to overhaul the criminal justice system.