“As a witness over you” means that on the Day of Resurrection he will testify before Allah—Exalted is He—that he conveyed to you the message of Allah and left you with no excuse. The Almighty says: “[We sent] messengers, as bearers of good news and as warners, so that mankind might have no argument against Allah after the messengers.” (al-Nisaʾ 4:165)
Accordingly, no one will be able to say on that Day, “I had no idea I was created to worship, I did not know what was obligatory for me, nor what was forbidden.” Such a claim will be impossible, for the messengers—peace be upon them—did convey the truth. Moreover, this Muhammadan community will testify against the other nations. Allah says: “Thus We have made you a balanced community so that you may be witnesses over mankind, and so that the Messenger may be a witness over you.” (al-Baqarah 2:143)
Therefore, on the Day of Judgment this community will bear witness that the earlier nations did receive the messages of Allah through their prophets, a fact they know from the Book of Allah, for He has narrated to us the stories of former peoples, their messengers, and what those messengers said to them. All of this we have learned from the Book of Allah—falsehood cannot approach it from before it or from behind it; it is a revelation from the All-Wise, the Praiseworthy.
As for the Messenger—Muhammad (peace and blessings be upon him)—he will be a witness against you, O community of Muhammad, testifying before Allah that he established the proof, conveyed the message, and sincerely advised you for Allah’s sake. Consequently, no one— not even the disbelievers—will have grounds on that Day to say, “Nothing reached me; no warner ever came to me.”