The king gave the order to his general, Joab, that Uriah should be placed in the front lines of the battle, where it was the most dangerous, and left to the hands of the enemy (where he was more likely to die). David had Uriah himself carry the message that ordered his death. After Uriah was dead, David made the now widowed Bathsheba his wife.
An accessory or hiring someone to committing to murder can be sentenced to life or the death penalty too. This can be applied to Christians who vote for pro-abortion candidates as well. God still charged David with blood on his hands.