Alexander Tilghman, 28, had no “obvious” connection to the victims or the restaurant he opened fire on, officers in the city said, but he seemed “determined” to shoot once he got there on Thursday.
His social media accounts show he previously believed his television had been possessed by the devil, and he begged for help from “a real human” saying he was suicidal, lonely and “really losing it”.
As well as the three people shot in the attack, one man broke his arm as he tried to flee.
All the victims were in a “good condition” on Friday, police said.
Troy Stevenson, the director of the LGBT rights group Freedom Oklahoma said Tilghman had distributed leaflets around Oklahoma City warning of demons taking over people’s bodies.
A neighbour, Ryan Beaulac, said leaflets with similar messages about demons, including “demons in cloned transexual (sic) bodies” were plastered on his car.
Mr Beaulac said he saw him on Wednesday night, adding: “He was twitchy, grabbing his hair and acting weird.
“I was uncomfortable and definitely wanted to get away from him.”
A man who claimed to be the gunman’s brother told television station KOCO: “Nobody reached out to him, you know. He was crying for help.”
As an armed security guard, Tilghman was licensed to carry a firearm. He would have been subjected to a background check and 72 hours of training.
Police said they had one interaction with Tilghman, when he was arrested when he was 13 after his mother said he punched her several times in an argument about a vacuum cleaner.
On Tilghman’s YouTube page, his bio reads: “A Real Human Exposing The Demons In Cloned Transexual Bodies.”
His numerous videos have titles including Demon Birds At Walmart and Demonic Squirrel and Parrots.
Oklahoma City Police Captain Bo Mathews praised the two bystanders who shot Tilghman.
He said: “They were able to shoot the suspect and put an end to a very dangerous situation.”
It is unlikely the men who shot him will face any charges.
The restaurant where the shooting took place was closed on Friday, and counsellors were provided to help employees and customers.
The National Rifle Association said on Friday that the situation showed “the best way to stop a bad guy with a gun is a good guy with a gun”.