In "The Secret of Father Brown" by G. K. Chesterton, Father Brown was criticizing detectives that treat criminals as low humans instead of trying to get inside them and understand their thoughts and motives, saying:
No man’s really any good till he knows how bad he is, or might be; till he’s realized exactly how much right he has to all this snobbery, and sneering, and talking about ‘criminals,’ as if they were apes in a forest ten thousand miles away; till he’s got rid of all the dirty self-deception of talking about low types and deficient skulls; till he’s squeezed out of his soul the last drop of the oil of the Pharisees; till his only hope is somehow or other to have captured one criminal, and kept him safe and sane under his own hat.
I know the meaning of "keep sth under hat", which means keep secret, and I also know the meaning of keep safe and sane, but can't get the whole meaning of "kept him safe and sane under his own hat"?