at the time of his divorce. This is impermissible by the consensus of the Muslims.
Even if the particular person seeking the ruling were to say, “I did not know this, and from today onward I shall abide by it,” that would not entitle him to do so, because this opens the door to making a game of religion and allows what is lawful and unlawful to be determined according to personal desires. And Allah knows best.
He—may Allah have mercy on him—was asked:
A man married a woman whose guardian is openly sinful, consuming unlawful wealth and drinking wine. The witnesses are likewise, and he has now divorced her three times. Does this afford him a dispensation to take her back?
He answered:
If he has divorced her three times, the divorce takes effect. Whoever begins examining the nature of the marriage contract after divorce, without having examined it beforehand, is transgressing the limits set by Allah, for he seeks to treat as lawful what Allah has forbidden, both before and after divorce.
According to Mālik, Ahmad and other imams, divorce takes effect in an invalid marriage whose validity is disputed. Moreover, a marriage contracted under the guardianship of an openly sinful person is valid according to the vast majority of imams. And Allah knows best.