1 Kings 21:27

And it came to pass, when Ahab heard those words, that he rent his clothes, and put sackcloth upon his flesh, and fasted, and lay in sackcloth, and went softly.

This belongs to the later years of Ahab's life, while Elijah was still serving as prophet in Israel. It concerns the vineyard of Naboth the Jezreelite beside the royal palace, which Ahab set his heart on possessing for a vegetable garden of herbs because it was near his house, offering either to buy it for money or to exchange it for a better vineyard. He acted from a naturally covetous disposition, following the dictates of his evil heart until he was fully controlled by the spirit of selfishness, able to brook no refusal of his wishes and feeling that whatever he desired should by right be his. That disposition was strengthened and sustained in wrongdoing by Jezebel, whose evil influence over him from the first continued and bore fruit in deeds of shame and violence seldom equaled, for he sold himself to work wickedness as his wife stirred him up. The incident thus reveals his dominant trait, which disastrously influenced the fortunes of the kingdom under his successors.

Elijah sternly rebuked the flagrant evil of wicked Ahab murdering Naboth and seizing his vineyard, prophesying the doom of Ahab himself and the doom of all his house. On hearing those words of judgment against his house, Ahab tore his clothes, put sackcloth upon his flesh, fasted, lay in sackcloth, and went softly and humbly, with outward mourning expressing humility before God.

God acknowledged that humility by postponing the announced disaster on his house until the days of his son. Even a king as powerful as Ahab remained under God's supreme authority.