For the second time, a judge has dismissed a host of criminal charges against Brandon Bostian, the engineer operating the Amtrak train that derailed in Philadelphia in 2015, killing eight people.

Bostian, 36, accelerated Train 188 to 106 mph, more than twice the posted speed limit, as he approached a bend in the tracks shortly after stopping at 30th Street Station. The speed threw the train off the tracks, but what happened did not rise to criminal recklessness, Common Pleas Court Judge Barbara McDermott decided Tuesday.

“The law recognizes we’re all human,” she said. “The law recognizes there is the occasional case where a departure from the rule may be appropriate.”

Bostian was scheduled to go to trial in September on 216 counts of reckless endangerment, one count of causing a catastrophe, and eight counts of involuntary manslaughter in connection with the May 12, 2015, derailment. More than 150 people were hurt.

The state Attorney General’s Office, which was prosecuting the case, has 30 days to file an appeal, and Christopher Phillips, a deputy attorney general, said his office would do so.

Tuesday’s ruling is a moment of déjà vu for Bostian. In September 2017, Municipal Court Judge Thomas Gehret dismissed all counts against him, also determining there wasn’t sufficient evidence of criminality in the case. Gehret’s decision was overruled, setting the stage for a criminal trial.

A federal investigation concluded Bostian had no alcohol or drugs in his system, and was not using his cellphone at the time of the derailment. Bostian told investigators from the National Transportation Safety Board that he couldn’t remember why he didn’t slow the train as it approached the curve.

>> READ MORE: NTSB: Amtrak crash went ‘from distraction to disaster’ in seconds

A SEPTA train had reported being hit by a rock shortly before the derailment, and investigators concluded that incident could have distracted Bostian and caused him to lose “situational awareness,” though Bostian said in his interview with NTSB investigators that he didn’t think he was overly concerned about the rock-throwing, which shattered the SEPTA train’s windshield.

In more than an hour of arguments Tuesday, Brian McMonagle, Bostian’s attorney, noted that minutes before the derailment, Bostian heard radio chatter from a SEPTA engineer whose train had been hit by the rock and argued that Bostian was traveling through a crime scene. He, like the NTSB, said Bostian was likely distracted. Before hearing about the rock-throwing incident, Bostian had performed his route from Washington to New York City without error.

“He was perfect all night, perfect out of 30th,” McMonagle said. “Goes through a crime scene, imperfect.”

During the hearing, Bostian mentioned to the judge he was taking medication for depression and had been having trouble concentrating or doing paperwork since the derailment. His parents were in the courtroom Tuesday and declined to comment, but McMonagle said Bostian is still struggling with the facts of the derailment.

“He is a victim of this accident, and you saw a little bit of this,” he said.

The dismissal would be hard to accept, though, for many of the derailment’s survivors and the families of those killed, said Thomas R. Kline, a Philadelphia lawyer who represented people injured in the crash, and the family of one woman killed. Many survivors of the derailment experienced life-changing injuries, and Kline wants to see a legal finding that holds Bostian responsible.

“It would be a shame if there were no personal accountability of any kind for Mr. Bostian,” he said. “That would be wrong.”

>> READ MORE: Surviving Car One

The hearing Tuesday began with Phillips offering a plea deal that would have dropped the vast majority of charges against Bostian, including the most serious — the counts of involuntary manslaughter. If he pleaded guilty to nine counts of recklessly endangering other persons, Phillips said, the state would not ask for jail time or an acceptance of guilt. Bostian rejected the offer, even though he said he calculated that if convicted on all counts, his maximum possible sentence wouldn’t end for half a millennium.

“I understand that," Bostian said, “and it’s a decision I am making.”

The Philadelphia District Attorney’s Office first declined to charge Bostian. The father and husband of Rachel Jacobs, who died in the derailment, then filed a reckless endangerment complaint against Bostian. The District Attorney’s Office rejected the complaint, but a judge ordered charges to be filed. The District Attorney’s Office recused itself, and the state Attorney General’s Office stepped in as prosecutor.

McMonagle argued that it was incorrect for Common Pleas Court Judge Kathryn Streeter Lewis to reinstate charges after Gehret dismissed them. McDermott didn’t find that persuasive. More compelling, though, was McMonagle’s comparison of the Amtrak derailment to two cases on fatal car crashes from 2018, after Lewis’ decision, in which drivers were clearly negligent, but courts determined they had not committed crimes.

“We know he was negligent,” McMonagle said, gesturing to Bostian, “but was there criminal negligence?”

Phillips countered that as a trained engineer responsible for the lives of 250 people on seven cars, Bostian faced a higher standard than a person driving a personal vehicle. He was trained to know his surroundings and to deal with incidents like rocks being thrown at trains.

“Bostian manually accelerated his train, several times, to get to a speed of 106 in an area that he was trained to know by memory could only support 50 mph,” Phillips said.

What Bostian did was more egregious than the two motor vehicle cases McMonagle cited, he said.

McMonagle, though, asked the judge to compare Bostian to a doctor who had gone through four years of medical school and had successfully performed an operation many times before; one day, the doctor makes an error and a patient dies. That doctor would not be criminally responsible, the attorney argued.

“This case is the doctor who’s in the emergency room and somebody comes in with a gun or a stone and throws it at him during a surgery, and they lose a patient,” he said. “This is wrong, judge, it’s dead wrong.”

As McMonagle framed the derailment as a tragic accident, Bostian’s mother at times leaned forward and pressed her forehead against her hands.

After dismissing the case, McDermott reminded Bostian that he could still be charged, depending on the outcome of an appeal. He also may face civil liability, lawyers said. But as they left the courtroom, Bostian’s family could be heard saying, “It’s a wonderful day, a wonderful day.”