Ahab though wicked refused to hand over the Scroll of the Law to Ben Had ad and for this alone was saved from the siege by the latter. Jehoran, his son likewise wicked, yet put on sackcloth together with Israel, and was helped by God against the foe.
Why Even Wicked Kings Were Saved for One Mitzvah
Gaster, Exempla of the Rabbis No. 282 (1924); Sanhedrin 102b