I mean I’m somewhat interested in how the Wizarding world manages to keep hidden despite all the kids from the muggleworld supposedly having friends and connections and things before Hogwarts.
I imagine the kindest answer to that involves magical law enforcement obliviating and confounding any witnesses, akin to how Gilderoy Lockhart had a career but perpetrated at scale on a large populous of second-class citizens (aka Muggles). Which is horrifying, but any other answer I can think of is somehow worse than wizard cops mind raping anyone who saw anything.
As commander in chief, communicating with the military is definitely a core duty and absolutely immune. So is writing pardons. So you just order the military to crime in your name and pardon them afterward.