Security guards saw the man attempting to steal some hats and took back the merchandise, police said.