If that is what happened, I think the cop did the right thing.
Why would a mentally unstable man have a machete in the first place? That’s scary enough all by itself. Eventually that guy was planning on using it in some way, and my guess is not in a good way. So he turned it against the Cops. Good riddance to bad rubbish. Glad the guy is dead, and I suspect his family is secretly relieved also. At least they know he won’t be coming after them now.