Mostly, what I've seen of "stupid" behavior (in Cipolla's use of the term "stupid") is the result of such motivations as spite. Spite appears to be one of the strongest motivators in human nature, and is purely destructive. It is, at its best, designed to not do the spiteful party any harm -- but no thought is put into doing oneself any good. It is often veiled in justifications related to evening some imaginary scales between a "bandit" and a "helpless" victim, but all too often it is simply spite beneath the surface -- in short, it is a special case of stupidity (and my own least favorite form of stupidity, because of its petty malevolence).
This has little or nothing to do with IQ and other conventional definitions of "intelligence" and "stupidity". It is, as I've said above, about patterns of behavior (and, to an extent, the motivations that produce those patterns).