Ahhh... it's FOUR laws of robotics.... asimov revised it...
4) a robot may not harm humanity or allow humanity to come to harm as long as it doesn't break the first three laws....
But that all lasts the ten seconds it takes for a religious nutter President to type in the code that identifies everyone but him as Godless Infidels. As soon as that gets uploaded the Bot turns on the bus load of school children.
The real reason for Millitary bots is this. The USA, Australia, and the assorted other tyrannies masquerading as Democracies are going to have to surrender territory consistent with their percentage of the global population. If you have used your share of the resources, You will be expected to die, not go looking for more.
In light of such a "reality" it falls on states to secure what they can take by force when the haves refuse to sell it for worthless currency.
In the end the Bot will be used by Paranoid christian minority rule states to police the Billion non-christian Populations they are going to have forced on them as Citizens.
Australia is opposed to the construction of a City for a Billion people in the Desert because 1,000,000 loyal policemen cannot possibly police 1,000,000,000 disloyal citizens. They have already abandoned the laws which required asking me and every citizen for our direct and regular approval regarding every act of Government, Law, Constitution, and Sovereign, and replaced it with "Do as you are told or we shoot you" laws.