Should he cancel the investment certificates after a fatwa was issued stating that it is prohibited to invest in them? And what is the ruling on previous profit?
Question

I used to deduct a portion of profits from the Islamic bank where I put my money, in order to avoid dubious transactions that could be subject to error. Then the fatwa concerning that changed, which meant that I should put my money in a current account. 1.. What is the ruling on what remains of these profits that were previously given to me? Do I have to calculate what I earned in the past and give it to the needy, with the aim of getting rid of it, or should I do that from the date that I came to know of the change in the fatwa? 2.. What should I do with the investment certificates? Should I wait until they expire and not renew them? Or should I cancel them immediately, and bear the resulting losses for not completing the stated period?
Praise be to Allah.Firstly:
If the Islamic bank put some of its money into bonds or riba-based treasury bills, or it invests the money in organized tawarruq [a trick whereby the bank pays for an item on behalf of a customer, then asks the customer to pay back more than the original price, to be paid in instalments. The customer then sells the item himself, or asks the bank to sell it on his behalf, in order to obtain cash], it is not permissible to invest money in it, because according to the investment contract, the bank is representing itself and acting as a proxy for the investors, so the sin of the haraam transactions it is doing will also be on them, and the sin is not waived from them by getting rid of the haraam interest.
Secondly:
Regarding the riba-based interest that you received before coming to know of the prohibition , you may make use of it, whether you spent it already or you still have it, because Allah, may He be exalted, says regarding riba (interpretation of the meaning): {But Allah has permitted trade and has forbidden interest. So whoever has received an admonition from his Lord and desists may have what is past} [al-Baqarah 2:275].
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said: What there is no doubt about, in our view, is that whatever he received on the basis of a misunderstanding or ignorance, he may keep what is past, without a doubt, as is indicated by the Qur’an and Sunnah and the correct scholarly view.
End quote from Tafseer Aayaat ashkalat ‘ala Katheer min al-‘Ulama’ (2/592).
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said: If he was not aware that this is prohibited, he may keep everything that he acquired, and he does not have to do anything; or if he was confused by a fatwa issued by a scholar which stated that it is not prohibited, he does not have to pay anything. Allah, may He be exalted, says (interpretation of the meaning): {So whoever has received an admonition from his Lord and desists may have what is past, and his affair rests with Allah} [al-Baqarah 2:275].
End quote from al-Liqa’ ash-Shahri (67/19).
And he (may Allah have mercy on him) said: What we learn from the verse is that whatever a person receives of ribe (interest) before coming to know of the prohibition is permissible for him, on condition that he repents and stops engaging in that transaction. End quote from Tafseer Soorat al-Baqarah (3/377).
Thirdly:
You must stop investing in this bank, whether that is through an investment account or through limited-time certificates, even if that results in losing some money, so as to flee from dealing with riba and in obedience to the command of Allah, may He be exalted (interpretation of the meaning):
{O you who have believed, fear Allah and give up what remains [due to you] of interest, if you should be believers.
And if you do not, then be informed of a war [against you] from Allah and His Messenger. But if you repent, you may have your principal - [thus] you do no wrong, nor are you wronged} [al-Baqarah 2:278-279].
And Muslim narrated that Jaabir (may Allah be pleased with him) said: The Messenger of Allah (blessings and peace of Allah be upon him) cursed the one who consumes riba and the one who pays it, the one who writes it down and the two who witness it, and he said: they are all the same.
And Allah knows best.