QUINCY — Wilfredo Justiano Jr. started screaming as soon as he saw the state trooper step out of his cruiser.

Justiano, a 41-year-old New Bedford man whose erratic behavior had prompted a 911 call from another driver, grew more agitated the more the trooper tried to calm him down, insisting he was an undercover police officer one moment and demanding the trooper kill him the next, according to an internal investigation. Undeterred by a blast of pepper spray, Justiano lunged at the trooper with a pen and was shot twice. He later died.

Tragic encounters between law enforcement and the mentally ill, like the one that ended Justiano’s life in Quincy last June, have helped spur new training programs in Massachusetts and across the country aimed at changing officers’ approach toward people with mental illness from the moment they arrive at a scene. Starting this year, graduates of nearly all municipal police academies in Massachusetts will receive 12 hours of training geared toward de-escalating encounters with the mentally ill and preventing avoidable arrests, incarceration and, in the worst cases, violence.

“When someone is in a psychiatric crisis, if a first responder is inappropriately skilled, the situation can escalate dramatically,” said June Binney, director of the Mass. Criminal Justice Project at the Massachusetts chapter of the National Alliance on Mental Illness. “What may not have been a particularly dangerous or violent situation in the first place can quickly, on a dime, turn into a very dangerous situation.”

Binney and a team of colleagues were on the South Shore on Thursday to train more than 60 police officers, social workers, psychiatrists and psychologists in the new 12-hour curriculum, which was developed by the state Department of Mental Health and the Massachusetts chapter of the National Alliance on Mental Illness. The lessons, which will be introduced at nearly all police academies in the state, are seen as a way to keep minor disturbances caused by the mentally ill from becoming serious confrontations with police.

The new curriculum also represents a major change in police training in Massachusetts: Before the curriculum’s introduction last fall, police cadets received only four hours of instruction on dealing with people with “special needs,” which included those with seizure disorders, blindness or autism as well as the mentally ill. “It was a police officer reading off of a script,” Binney said.

In addition to being far longer and more extensive, the new curriculum is led by a mental health professional as well as a police officer and includes a variety of role-playing exercises meant to help officers understand how a mentally ill person experiences reality. In one exercise, meant to simulate the experience of a person with schizophrenia, several people gathered around a woman and whispered threatening commands in her ears — “shut up” “don’t do it” “you’re a mess” — while another person stood in front of her and played the role of a police officer booking her after an arrest. Distracted by the voices in her ears, the woman struggled to answer basic questions.

Page 2 of 2 - Trainees are also given a range of instruction on how to make a person feel at ease and in control of a situation, from using a calm voice and giving the person space, to keeping an officer’s hands in his pockets and using a first name in talking with the person. Binney said the instructions are often “counterintuitive” to officers who are trained to take control of a situation as soon as possible — an approach that can make a person experiencing a mental health crisis feel threatened.

While many police departments in Massachusetts already have clinicians or specially trained police officers who can be called in to de-escalate confrontations with a mentally ill person, Steve Turner, a Taunton patrolman and one of the instructors at Thursday’s training, said it is important for all officers to be trained in dealing with the mentally ill because they never know what kind of situation they’re about to walk into.

Turner said the police community is beginning to embrace mental health work as part the role of law enforcement, a big change from 26 years ago when he went through the academy and didn’t hear a word about mental health. He estimates that about half the 911 calls that Taunton police receive are related to mental health issues.

Binney said the new police training curriculum is part of a larger movement to keep mentally ill people out of the criminal justice system — where mental health issues often go untreated and can worsen — and divert them to appropriate treatment programs instead. A 2006 study by the Bureau of Justice Statistics found that more than half of all prison and jail inmates in the country had a mental health problem, several times the rate found in the general population.

“The further a person gets into the criminal justice system, the harder it is for them to get out,” she said.