With regards to the virtue of seeking knowledge with a pure intention, the Shaykh Muhammad ibn Saalih al ‘Uthaymeen rahimahullaah comments:
Rather some of the scholars say that seeking knowledge with a pure and sincere intention is more excellent than fighting in the Path of Allaah because fighting in the Path of Allaah contains only blocking the enemies and fighting against them such that there is no fitnah and that the Religion is entirely for Allaah.
However seeking knowledge is something that the whole ummah (Muslim nation) is in need of, such that they can worship Allaah upon clear-sightedness; and (even) the people who fight (in the Path of Allaah) are in need of it such that they know how they should fight and how they deal with the war booty and how they advance and how they retreat.
So the ummah is in need of knowledge, in every situation and at every moment.
Therefore I urge you, O young people, to turn towards and have diligence upon seeking Sharee’ah knowledge, and to have purity and sincerity of intention in that – in that you intend by it seeking closeness to Allaah, the Perfect and Most High, by obeying His command; and that you intend protection of the Islaamic Sharee’ah and defending it and spreading it among the servants (of Allaah).
Then you attest to the truthfulness of this intention through your actions, in worship and manners and dealings (with other people).
Quoted in Wasaayaa wa tawjeehaat li tullaab il ‘ilm pages 341, translated by Nasser ibn Najam