Harry answered, "Because Hermione was in Malfoy Manor, and killed an enemy of Lord Malfoy, on the orders of Lord Malfoy—who is me. Which made Hermione killing the wizard be legal by the laws of Wizarding Britain. By the same logic, Hermione and Sirius legally killed Lord Voldemort."