Sincerity in Seeking Knowledge is a condition that is continual and successive not just initial and preliminary:
What this means is that the student of knowledge should continually strive to implement sincerity in himself, and that he should not refrain from his studies due to the claim that he did not achieve sincerity.
Some scholars have provided the following definition for sincerity (Ikhlaas):
Ibn Jamaa’ah said: “It means that one has a good intention when seeking knowledge, by intending through his studies to please Allaah, to act in accordance to what he learns, to revive the Sharee’ah (Islamic legislation), to illuminate his heart, to elucidate its (i.e. knowledge’s) hidden meanings; to get near to Allaah on the Day of Judgement, and to subject oneself to what Allaah has prepared for those who possess it from His Contentment and great virtue.”
Sufyaan Ath-Thawree (rahimahullaah) said: “I did not try to rectify anything that was more difficult on me than my intention.”
One should not intend, by his search for knowledge, to fulfill some worldly goal such as achieving leadership, gaining status and wealth, competing with colleagues, having people extol him, taking the front seat in a gathering, and so on, by which he would be exchanging that which is better for that which is lower.
Abu Yoosuf, may Allaah have mercy on him, said: “Intend Allaah through your (search for) knowledge, for indeed I never sat in a gathering of people in which I made it my intention to humble myself except that I didn’t leave from it until I had surpassed them. And I never sat in a gathering of people in which I made it my intention to surpass them, except that I didn’t leave from it until I was disgraced.”
Knowledge is one of the many acts of worship and one of the many ways of gaining nearness to Allaah. So if one purifies his intention when seeking it, his deed will be accepted and purified, and its blessing will be perfected. However, if he intends other than the sake of Allaah when seeking knowledge, his deed becomes nullified and wasted and his transaction is lost. And perhaps it may be that he misses out on these (worldly) objectives and never achieves them. So in this case, he will have failed his objective and wasted his efforts. 
* This principle entails several matters, the most important of which is:
The Devil enters into the heart of some people desiring to turn them away from knowledge based on the argument that one should leave off seeking knowledge until he first purifies his intention. This is a plot, scheme and deception of the Devil. Rather, it is upon the Muslim to continue and persevere in his search for knowledge, and to constantly re-evaluate his intention, as Sufyaan Ath-Thawree said: “I did not try to rectify anything that was more difficult upon me than my intention.”
And this is Sufyaan we are talking about, so it applies even more so for those other than him!! Therefore, one should not make this into something that diverts him away from seeking knowledge.
When Hishaam Ad-Dustawaa’ee, may Allaah have mercy on him, said; “By Allaah, I cannot (honestly) say that I ever went one day to seek hadeeth for the sake of Allaah”, Adh-Dhahabee, may Allaah have mercy on him, commented on this saying: “By Allaah, me neither!”
The Salaf would seek knowledge for the sake of Allaah, and so they became dignified and went on to become Imaams that were followed and looked up to by the people. And there were other people from among them who did not seek knowledge for the sake of Allaah at first, but yet they still attained the knowledge, then they woke up and examined themselves. And so the knowledge led them to have sincerity on their path (to seeking knowledge).
This is as was stated by Mujaahid and others: “We sought this knowledge while not having a big intention concerning it. Then Allaah granted us the intention (for it) afterward.”
And others would say: “We sought this knowledge for other than the sake of Allaah. But the knowledge refused that it should be sought except for the sake of Allaah.” So this is also good. Then, afterward, they went on to spread the knowledge with righteous intentions.
And there were other people that sought knowledge with corrupt intentions, for the sake of the worldly life and so that they could be praised by the people, so they got what they intended.
The Prophet SAWS said: “Whoever fights in battle with the intention of (getting) war booty, he will have what he intends.”
You will find this type of people not being illuminated by the light of knowledge. The knowledge has no impact on their souls nor does it produce a big result in their actions. Rather, the one with knowledge is only he who fears Allaah.
Then there were other people that attained knowledge and achieved positions due to it, but they oppressed people and abandoned the requisites of knowledge, thus embarking on committing major sins and lewd acts!! So woe be to them – these people are not scholars.
Some other people do not fear Allaah with regard to their knowledge, but rather engage in schemes, issuing verdicts permitting prohibited matters and reporting unauthentic and irregular narrations.
Other people show audacity before Allaah and fabricate ahaadeeth, so Allaah exposed them and their knowledge left them. And so their preparation became for the Hellfire.
All of these types of people took in a large portion of knowledge, and they excelled in it, in the general sense. Then they were succeeded by later generations that had deficiency in knowledge and action. Then there followed a people that ascribed themselves to knowledge outwardly, however, they did not become well versed in it except for a few among them who thought that because of that they had become noble scholars. But it did not cross their mind that they were gaining nearness to Allaah through it. The reason for this is because they did not see a shaikh that was taken as a role-model with regard to knowledge. So they became like savage barbarians. The highest objective of the teacher from amongst them is to obtain costly books, amassing them, to look into on any given day. So he would misinterpret what is stated therein and not agree with it. We ask Allaah for salvation and pardon.
This is as some of them said: “I am not a scholar, nor have I seen a scholar.” 
This third foundation is from amongst the important principles, and it is that the student strives to make his intention purely for the sake of Allaah when seeking knowledge.
Achieving sincerity is something necessary. Allaah says: “And they were commanded not except to worship Allaah sincerely, making the worship purely for His sake.” [Surah Al-Bayyinah: 5}
As we mentioned previously, seeking the religious knowledge by which one can properly implement the worship of Allaah is itself an act of worshipping Allah. And it is part of the implementation of Laa Ilaaha IllaaAllaah. So in summary, it is an act of worship that one should strive to have sincerity in when performing it. The Messenger of Allaah SAWS said: “Verily, actions are based on intentions. And verily, every man will have what he intends.”
Based on this, we say: A student of knowledge must continuously strive to correct his intention and to make it purely for the sake of Allaah.
Someone may say: “Does this mean that I should not seek knowledge until I (first) correct my intention?”
I say: No. Rather, you should seek knowledge. But while you are seeking knowledge, you should examine yourself and rectify yourself by way of correcting your intention.
If this person continues, saying: “I want to leave off seeking knowledge until I (first) correct my intention!!”
Then I reply by saying: This is a plot from the Devil. He has opened up for you one of the doors of good intending by that to turn you away from that which is better and greater. So therefore, you should continue and be perseverant in your search for knowledge. And you should continually rectify yourself, for indeed your knowledge – Allaah-willing – will guide you to make your intention sincerely for the sake of Allaah.
The Salaf would say: “We sought this knowledge for other than the sake of Allaah. But the knowledge refused that it should be sought except for the sake of Allaah.”
 End quote from Tadh-kirat-us-Saami’ wal-Mutakallim (pg. 69-70)
 Siyar A’laam an-Nubalaa (7/152-153)
Published: November 21, 2005 | Modified: January 4, 2006