The same applies when the oath concerns committing a disliked act or abandoning a recommended one. This is what is referred to in the words of Allah Most High:
“Do not make your oaths by Allah an excuse against doing good, being mindful of Him, and making peace between people. Allah is All-Hearing, All-Knowing.” [al-Baqara: 224] [al-Baqara].
If, however, the oath concerns abandoning an obligation or committing a prohibited act, then fulfilling it is impermissible by consensus. Rather, according to the great majority of scholars, expiation must be offered.
Before expiation was prescribed, a person who swore such an oath was not permitted to fulfill it, nor was any expiation available to relieve him of the consequences of breaking it. He would instead be guilty of a sin for which there was no expiation, whether he fulfilled his oath or not. This is like one who vows to commit a sin, according to those who prescribe no expiation for such a vow; [and as when] what is sworn to is the performance of a non-obligatory act of obedience.
[Chapter: One Who Swears by Means of a Vow—Namely, a Vow Made in Obstinacy or Anger]
Chapter
As for one who swears by means of a vow—namely, a vow made in obstinacy or anger—such as saying, “If I do such-and-such, I must perform Hajj—or my wealth shall be given in charity, or I must fast,” intending thereby to prevent himself from doing it; or saying, “If I do not do such-and-such, I must perform Hajj,” or something similar: the position of the scholars of Mecca, Medina, Basra, and Kufa is that expiation for an oath suffices him. This is also the view of the hadith jurists, including al-Shāfiī, Ahmad, Ishāq, Abu Ubayd, and others. It is one of the two reports from Abu Hanīfa and is the later report transmitted from him.
They then differed. Most of them held that he may choose between fulfilling what he vowed and offering expiation for an oath. This is the view of al-Shāfiī and the well-known position of Ahmad, whereas some of them—