MIAMI — The first time that students at Miami Northwestern Senior High School walked out of classes to protest the shooting death of a sophomore named Kimson Lee Green, administrators urged them to stay on campus.

The administrators did not disagree with the student’s cause or want more class time. It was just that going off school grounds was too dangerous.

While the students wanted the freedom to protest gun violence, like other high schoolers in the fledgling national youth movement, the realities of their gang-plagued neighborhood kept getting in the way. But they were insistent.

“We were just fed up,” said Destiny Robinson, 18, a senior and the student body vice president at the school of about 1,600.

Forty miles north and a world away, students from Marjory Stoneman Douglas High School in Parkland had two weeks earlier organized a national march against school violence. Their protest drew celebrities, politicians and hundreds of thousands of people, including several Northwestern High students who traveled to Washington in solidarity.

Yet when the Northwestern students walked out in their neighborhood of Liberty City, they did not even have the support of their entire community — and not just because it was risky. The debate over guns and bloodshed is old and fraught in this part of town, and bringing youngsters into it, some community leaders said, felt wrong.

“I’m the adult in this environment — if something is broken, then the adults fix it,” said T. Willard Fair, president of the Urban League of Greater Miami, who added that the school should have prevented the protest. Gun violence, he said, is “not going to change by walking out.”

In the end, the Northwestern High walkout happened, it boldly proceeded off campus, and it was met mostly with support. But the mixed feelings exposed a striking divide over how different communities respond to violence. In places like Parkland, where a shooting rampage is so unusual that it is shocking, a show of outrage is almost expected. In places like Liberty City, where violence has been an intractable problem for generations, protests carry their own perils.

Young people in inner cities across the country, from Baltimore to Chicago to Los Angeles, have taken inspiration from the Parkland students to say that they, too, are tired of seeing their friends in coffins. Yet Liberty City, because of its proximity to Parkland, provides the most stark example of the disparate challenges for activists.

“They see people of color, African-Americans, and they automatically think it’s aggressive,” said Ricky Pope, an 18-year-old junior at Northwestern High, which is across the street from the county’s largest housing project.

The 56-acre Liberty Square project, opened in 1937 as part of the New Deal, is a maze of dilapidated, faintly pastel-colored buildings on a treeless landscape of parched grass. Locals know it as the Pork and Beans. It is also the setting for “Moonlight,” the movie about a young black man growing up in Miami that won the Academy Award for Best Picture in 2017.

In 2015, a 15-year-old freshman named Johnny Lubin Jr. was shot to death walking home from school. He was the fourth Northwestern High student killed that year. (Three of the homicides remain unsolved.) This year’s graduation ceremony, as in years past, will include a memorial tribute to this year’s “Fallen Bulls.”

“How many schools even have to do that?” Mr. Pope said.

The principal, Wallace Aristide, said he worried about students’ safety on weekends. “I would love if it was possible for me to have the students with me 24/7,” he said.

The police patroled the Liberty Square neighborhood after a deadly shooting that claimed the lives of two teenagers, Kimson Green and Rickey Dixon.CreditEmily Michot/Miami Herald, via Associated Press

Mr. Green, 17, and Rickey Dixon, 18, a former student, were killed on the afternoon of April 8 in a shooting that left two other young men critically injured. Mr. Green, an only child nicknamed Suge, attended Saturday classes to get ahead and was about to be inducted into the National Honor Society.

With his death, his classmates decided they had had enough.

To reach the lawn where the young men were gunned down, students had cross into gang territory where some knew they would be unwelcome.

They went anyway, by the hundreds. Police stopped traffic. Students who felt unsafe hung back at the median, as close as they could get to Liberty Square without inviting trouble. A few students clambered onto the rooftops of the dingy duplexes, waving handmade signs. Below, a memorial honored the fallen with flowers, balloons, candles and teddy bears.

“Everyone got to see that the children from Liberty City who see these tragedies on a daily basis are not just silent,” said Mr. Pope, the student activist.

Then came the criticism from their own community. Some said the students were trying to cut class — even though they went right back to school after the walkout.

“That one really got to me,” Sonya Brown-Wilson, 53, said at a separate march for gun violence survivors, this one organized by adults, held about a week after the shooting. “I was very proud of the students. I was hoping that they would get the same response Parkland did, but it wasn’t the same.”

Ms. Brown-Wilson walked, draped in yellow police tape, in memory of a slain 24-year-old nephew, as the crowd chanted, “Stop the violence! Stop the silence!” “I don’t want to see any more of it,” she said. “I’m tired.”

The fallout after the walkout made some students go quiet. They declined interview requests for fear of negative attention, according to several teachers. Some students also worried about retribution if they were seen as keeping attention focused on the shooting deaths. No one has been arrested.

“We’re always in the news for all the wrong reasons,” lamented Brene’e Davis, 17, a senior and the student body president.

Police sent more patrols to the neighborhood; they arrested 86 people and confiscated 19 firearms. Local leaders held discussions. Community organizations participated in a peace walk and a kickball game welcome to all.

In private, the students stayed mobilized after their walkout, meeting with longtime activists on weekends and after class, trying to hash out their message and plan their next steps. A social justice club is in the works at the school, where teachers like Kala Jones say they are in awe of students willing to speak out against the violence and the unwritten street rules — like, for example, not crossing into gang territory — that she experienced growing up in the community.

“These kids now have the strength and confidence to say that to people,” Ms. Jones said. “They’re done with this idea of keeping it silent, because they’re so tired.”

Nine days after the walkout, on April 20, students across the country again left classrooms to mark the 19th anniversary of the Columbine massacre in Colorado. Ready for another protest, Miami police stood guard at Northwestern High. A patrol car waited out front. Officers mounted on horses stood by near the athletic fields.

This time, no students came out.

Follow Patricia Mazzei on Twitter: @PatriciaMazzei

Doris Burke contributed research.