"[It was] ordained for you," meaning: it was obligated upon you, "when death approaches one of you," the verse. Qatadah said: 'The good' refers to wealth. Allah, Blessed and Exalted is He, commanded in this verse that a bequest be made for the parents and near relatives, then that was abrogated in Surat An-Nisa' by His saying: "for his parents, to each one of them is a sixth," and the bequest became reserved for those who do not inherit, whether they are close relatives or distant.
Muhammad said: And His saying, Mighty and Majestic is He, "as a duty upon the righteous," the word "duty" (haqqan) is in the accusative case (mansub) based on the meaning: that was a duty upon them.
﴿كتب عَلَيْكُم﴾ أَي: فرض عَلَيْكُم ﴿إِذَا حَضَرَ أحدكُم الْمَوْت﴾ الْآيَة. قَالَ قَتَادَة: الْخَيْر: المَال، وَأمر تبارك وتعالى فِي هَذِه الْآيَة بِالْوَصِيَّةِ للْوَالِدين والأقربين، ثمَّ نسخ ذَلِك فِي سُورَة النِّسَاء بقوله: ﴿وَلأَبَوَيْهِ لِكُلِّ وَاحِدٍ مِنْهُمَا السُّدس﴾ وَصَارَت الْوَصِيَّة لمن لَا يَرث من قريب أَو بعيد.
قَالَ مُحَمَّد: وَقَوله ﷿ ﴿حَقًّا على الْمُتَّقِينَ﴾ نصب ((حَقًا))؛ على معنى: كَانَ ذَلِكَ عَلَيْهِم حَقًا.