That the state Attorney General’s Office found last year’s fatal shooting of Chance David Baker by police to be legally justified should not come as a surprise.

Just before he was shot to death on Feb. 18, 2017, Baker was brandishing what appeared to be a rifle (but was really a pellet gun) outside Union Station Plaza in Portland, and ignored repeated orders to put the weapon down.

Investigators were asked to answer a single, narrow legal question: At the moment that he pulled the trigger, did the officer reasonably believe he was acting in his own defense or the defense of others? If the answer is “yes,” there can be no prosecution.

But the fact that Baker’s shooting was legally justified does not mean that it had to happen. Things started going wrong in his life long before the final confrontation, and the events that brought him to that moment should be understood, if only to prevent someone else from falling into the same pit.

Baker’s friends describe a loving, good-humored young man who was ambitious and hardworking, at least until his mental state appeared to unravel.

In the months before he died, Baker had been periodically unemployed and homeless. Friends say he became withdrawn, paranoid and irrational.

That morning he drank heavily, bringing his blood-alcohol level to three times the legal limit for drivers. In his impaired state, he bought an air rifle that looked like the real thing from a distance and pointed it at strangers. Even under the influence, he should have known how police would interpret those actions.

Did Baker want to commit suicide? Was he delusional? Those are questions that a criminal investigation won’t answer.

Could the police have done more to defuse the situation? Maybe, but it’s hard to see how.

As long as they believed he might have a rifle, they could not risk the safety of passers-by. The Portland Police Department has mental health liaisons who were not dispatched to the scene. But a short, high-pressure encounter with an apparently armed man did not leave much room for de-escalation.

Did Baker have access to mental health services that could have prevented the episode? Doubtful. As an adult with no children, Baker would not have been eligible for MaineCare and his options would have been limited.

Attorney General Janet Mills has convened a task force to study police-involved shootings and look beyond the legal question about the justification of the use of force. Other community agencies are also asking questions about how to more effectively deliver services to people who need them.

Now that the narrow question of one police officer’s momentary judgment has been answered, it’s time to broaden the inquiry. Did we as a community do everything we could to keep Chance Baker out of that fatal confrontation last year, and are we doing what’s needed to save other young people from the same fate?