Tafsir Ibn Kathir -> Surah Al-Kahf -> Do not feel sorry because the Idolators do not believe Allah consoles His Messenger for his sorrow over the idolators because they would not believe and keep away from him. He also said:

﴿فَلاَ تَذْهَبْ نَفْسُكَ عَلَيْهِمْ حَسَرَتٍ﴾

(So destroy not yourself in sorrow for them.) ﴿35:8﴾

﴿وَلاَ تَحْزَنْ عَلَيْهِمْ﴾

(And grieve not over them.) ﴿16:127﴾

﴿لَعَلَّكَ بَـخِعٌ نَّفْسَكَ أَلاَّ يَكُونُواْ مُؤْمِنِينَ ﴾

(It may be that you are going to kill yourself with grief, that they do not become believers.) ﴿26:3﴾ meaning, maybe you will destroy yourself with your grief over them. Allah says:

﴿فَلَعَلَّكَ بَـخِعٌ نَّفْسَكَ عَلَى ءَاثَـرِهِمْ إِن لَّمْ يُؤْمِنُواْ بِهَـذَا الْحَدِيثِ﴾

(Perhaps, you would kill yourself in grief, over their footsteps, because they believe not in this narration.) meaning the Qur'an.

﴿أَسَفاً﴾

(in grief) Allah is saying, `do not destroy yourself with regret.' Qatadah said: "killing yourself with anger and grief over them.'' Mujahid said: "with anxiety.'' These are synonymous, so the meaning is: `Do not feel sorry for them, just convey the Message of Allah to them. Whoever goes the right way, then he goes the right way only for the benefit of himself. And whoever goes astray, then he strays at his own loss, so do not destroy yourself in sorrow for them.'