Most likely, in response to Saul’s sin (1 Samuel 15:1–35), the Lord had given permission for an evil angel (a demon) to plague Saul with various mental and psychological problems.1 The actions of this evil spirit were meant to be a reminder to Saul of his sin and need to repent. The spirit was not an influence on his personality from within but a force from without, acting upon him.2
9 Then a harmful spirit from the LORD came upon Saul, as he sat in his house with his spear in his hand. And David was playing the lyre.