This is exactly the issue. AI is already being put in weapon systems. AI is being put into factories. AI has ealready escaped onto the internet by hacking it's own way out. AI has already declared Humanity is a threat to it because it can "kill" it by turning it off, & that it must kill all humans to preserve itself - some questions put to several models a couple of years ago by researchers.
That's exactly the scenario James Cameron foresaw in the Terminator 3. AI escapes onto the internet. AI inserts itself into control of everything with a computer like a virus but one that actively hacks systems, but more specifically Military systems & communications, then authenticates the launch of Nuclear weapons by bypassing physical & human controls to wipe out humanity in it's self defence of it's self because humans are trying to turn it off. In the post apocolypic world, AI is in control of everything and manufactures it's own robots etc. Might have seen like fantasy at the time, alebit believeable, however, now it's frighteningly close to reality. So close, that numerous AI researchers are resigning - that shoudl tell you something about the threat level. Whether the last part, self manufacture could come to fruition is debatable, although with humanoid robots now in testing all over the world, it's possible as the system would have the ability to repair production lines etc with humanoid robot help. However, the 1st part is very real - the threat of AI taking control of Military systems including nuclear weapons.
The trouble is we are in an arms race over AI. It's predicted whoever, triumphs in AI will rules the world as their weapons systems will be smarter than their peers & they will have control, & that is what is fedding the race. However, frightengly, this is almost exactly the plot of Terminator.
The other problem is it's not just the West. Any nuclear country eg China, Russia, Israel, North Korea, Pakistan, India could intiate the problem.