Maybe the police didn't know with guaranteed 100% certainty that he had a gun. But there were pictures of him with his gun. He said he had a gun. He said he was willing to use that gun. It's not unreasonable that the police considered him armed and dangerous. Which he was.