Murder vs a human sacrifice to a God that does not accept them are two different things.and David, who was a man after God's own heart according to scripture, placed a warrior on the front lines and had the others abandon him there so he would be killed. There is no doubt that was premeditated murder. The Torah teaches against murder.
It is obvious that people are capable of breaking Torah law, even while professing to be a devout Jew.
God Punished David for killing Uriah.
As King David approached Bahurim, a man from the same clan as Saul’s family came out from there. His name was Shimei son of Gera, and he cursed as he came out. 6 He pelted David and all the king’s officials with stones, though all the troops and the special guard were on David’s right and left. 7 As he cursed, Shimei said, “Get out, get out, you murderer, you scoundrel! 8 The Lord has repaid you for all the blood you shed in the household of Saul, in whose place you have reigned. The Lord has given the kingdom into the hands of your son Absalom. You have come to ruin because you are a murderer!”