Echelon thought the same in the movie Echelon Conspiracy. Like you've said in a comment above, the AI can only learn from the data we feed to it and the parameters embedded in the code. For example if the parameter is "protecting freedom" eventually the AI could come to the conclusion that we're the biggest threat to freedom and then attempt to act accordingly. Meaning, what AI tells you now might be not the same as what AI THINKS in 20 years from now.
