When Eugene Harding came home Wednesday evening, he turned on the evening news to discover that a student had fatally stabbed a classmate during history class in a Bronx school.

A school social worker in New York City for 25 years, Harding formed a theory about what triggered the killing as soon as an image of 18-year-old Abel Cedeno — now accused of murder — flashed on the screen.

“I looked at the kid and my gut sense was, ‘Oh, he’s not a murderer,’” Harding said. “He was bullied.’”

Details are still emerging about what led Cedeno to allegedly draw a switchblade and plunge it into two of his classmates inside the Urban Assembly School for Wildlife Conservation — leaving one dead and another critically wounded. But according to statements by his lawyer and a family friend, Cedeno faced persistent bullying in a school that some parents say struggled to maintain order.

The incident, which marks the first time a student was killed by another student inside a city school in a quarter century, is raising fresh questions about the state of bullying prevention in America’s largest school system.

The education department has had an anti-bullying program in place since 2007, and all new teachers have received anti-bullying training since 2014. But it’s largely up to individual schools — through the environment they establish and the way they respond to incidents — to permit or prevent bullying.

Some schools have built strong cultures where bullying is rare and students learn to peacefully resolve conflicts, spurred in part by Mayor Bill de Blasio’s push for schools to shift away from harsh discipline policies. But at many others, students report frequent bullying and harassment that is ignored or inadequately addressed, according to student surveys, advocates, and school personnel — highlighting the difficulty of ensuring that each of the city’s 1,800 schools is safe for all students, particularly those whose identities make them targets.

“We know we have a huge problem that affects kids — some of them really, really seriously,” said Robert Faris, a sociology professor at the University of California, Davis who has studied bullying, referring to the prevalence of bullying nationwide. “But very little of what we’re doing is working.”

It’s hard to know exactly how much bullying happens in New York City’s schools.

Schools are required to report bullying incidents, but that self-reported data has been called into question. In the 2013-14 school year, 70 percent of city schools reported no incidents of intimidation, bullying or harassment. The state attorney general and education department concluded in a 2016 report that such a low incident rate indicated “significant underreporting.”

Meanwhile, about 81 percent of the 433,715 students in grades 6-12 who responded to the city’s annual survey last year said students harass, bully or intimidate each other at their school. Of those students, 43 percent said it happens “some” or “most” of the time, while 38 percent said it happens “rarely.”

Schools sometimes fail to input bullying reports in an education department database that triggers a process for responding to the allegations, according to Dawn Yuster, the School Justice Project director at Advocates for Children of New York, a group that supports students who have been bullied. She said some of her clients’ families had repeatedly gone to school personnel with bullying allegations — to no effect.

“There was no documentation until we got involved,” she said.

Yuster attributed some schools’ failure to document or respond forcefully to bullying partly to staffers’ uncertainty about what counts as bullying and how best to respond to it. In other cases, teachers and administrators may simply be overwhelmed.

“I don’t think it’s an unwillingness,” she said. “I think it’s more about resources, knowledge, experience, and training.”

In 2007, the city education department launched Respect for All, a program designed to raise awareness among educators and students about harassment and bullying, and how to prevent it.

Under the program, and state law, schools must create plans to stamp out bullying and harassment as soon as it bubbles up. They must also appoint a staff member to undergo anti-bullying training, handle bullying reports at the school, and act as a resource for students and staffers. And since anti-bullying training became mandatory for new teachers three years ago, 14,700 have taken the six-hour courses offered by the teachers union.

The de Blasio administration has also set aside $47 million per year for student mental-health services and trainings to help schools responses to student conflicts and crises.

“We take reports of bullying extremely seriously and have explicit protocols and robust training programs in place to ensure harassment, discrimination or bullying of any kind is immediately reported, investigated and addressed,” said education department spokeswoman Toya Holness.

Across the city, bullies are especially likely to prey on lesbian, gay, bisexual, transgender, and queer students — and those perceived as such.

In 2015, 24 percent of surveyed LGBTQ youth reported being bullied at school, compared with 13 percent of non-LGBTQ students, according to a health department report.

Abel Cedeno, the student who allegedly stabbed his classmates this week, endured homophobic and racial taunts, according to a family friend who spoke with reporters. Still, experts said it’s extremely rare for LGBTQ students — who suffer from disproportionately high rates of depression and suicide — to react to bullying with such violence.

The city recently appointed its first-ever LGBTQ liaison to help schools support those students. And in March, the city expanded protections for transgender students.

Yet despite these citywide initiatives, individual educators still often find it difficult to address LGBTQ bullying head-on, said City Councilman Daniel Dromm, a former teacher and longtime gay-rights advocate.

“Schools will talk about bullying in general, or diversity in general,” he said. “But teachers and principals still fear actual discussion around LGBT issues.”

Donavon Taveras, who identifies as queer and recently graduated from a Brooklyn high school, said the tone teachers set in their classrooms can make marginalized students feel either protected or vulnerable.

He recalled the time a teacher discussed homosexuality matter-of-factly during a health class. Taveras was so grateful he thanked the teacher after the lesson.

But in a different class, after Taveras read aloud a journal enjoy that referenced a boyfriend, a student muttered “faggot” loud enough for all to hear. Instead of reprimanding the student or turning the insult into a teachable moment, the teacher simply rolled his eyes and continued the lesson. Taveras still remembers how much that stung.

“If felt like everyone was against me,” he said.

Monica Disare contributed reporting.