A man carrying an assault-style rifle walked along one of Cambridge’s busiest riverfront roads Monday afternoon and fired more than 60 rounds at passing motorists, turning Memorial Drive into a scene of panic as drivers leapt from their cars and ran for cover, authorities said. Two people were hospitalized with life-threatening injuries, and bullets struck at least a dozen vehicles, including a state police cruiser.

The gunfire ended when a Massachusetts state trooper and a Marine veteran — who pulled over after hearing the shots — each returned fire, hitting the suspect, according to prosecutors and state police. “While people were jumping from their cars, scattering in various directions … both that trooper and that civilian, rather than going in one direction, went toward the suspect with their weapons to try to end that situation,” Middlesex District Attorney Marian Ryan said.

The suspect, Tyler Brown, 46, of Boston, faces two counts of armed assault with intent to murder and six other charges, including illegal gun possession. Court documents show Brown had been released Friday from a psychiatric hospital, where he was diagnosed with post-traumatic stress disorder, anxiety, and depression. He was on parole and probation for a 2020 armed assault conviction in which he fired several rounds at Boston police officers and received a five-to-six-year prison sentence after prosecutors had sought at least a decade.

About an hour before the shootings, Brown connected with his parole officer by video and, holding a firearm, said he had relapsed and wanted to end his life, the criminal complaint states. The parole officer called police, who began tracking Brown through phone records and found him in Cambridge.

Armando Zona, who lives in an apartment overlooking the scene, said he initially thought the noise was construction equipment. “He took a glance towards here, I’m quite sure about that, and I ran,” Zona said. As he yelled for his wife to hide, another bullet hit his home. “I turned around, I see the window splattered. I could not comprehend, how can this be? This is a bullet that just came into my house.”

Rachael Saveriano told The Boston Globe she was trapped in her car as Brown approached, waving his gun. A man later identified as the Marine veteran pulled her out and told her to run. “He is an incredible hero,” Saveriano said. “He was so calm, and he didn’t hesitate.” The Marine, a former firearms instructor, told investigators he retrieved a pistol from a lockbox in his backseat and fired eight rounds after the gunman drew closer, according to the complaint.

Joey Bennett, a friend of Brown’s, rode his bicycle to the scene and said he “can’t make sense of it.” He described Brown as someone who “had a good heart” and struggled with mental health. “He obviously was going through a moment because the person that I know, I don’t understand why he would be right here doing what he did,” Bennett said. “The only thing I can say is that mental health is real. Mental health is not taken seriously across the United States until there always is a shooting or something that happens to innocent people.”

The shooting quickly revived anger over the handling of Brown’s earlier case. The Boston Police Patrolmen’s Association called the previous leniency “an undeniable insult to those who put their lives on the line everyday.” Ryan said there was no connection between Brown and the motorists he targeted, and she urged lawmakers to impose stiffer penalties for reckless gunfire. “What happened today cannot stand,” she said.