( وَإِذْ ) (And [remember, O Muhammad], when): (When) is an adverb of time, and in this verse, it is to remind the Prophet (saws) of the time when the disbelievers plotted against him.
( يَمْكُرُ بِكَ الَّذِينَ كَفَرُوا ) (when those who disbelieved plotted against you): (Plotting) is scheming with secrecy. Before the Prophet Muhammad (saws) migrated from Mecca to Al-Medina, the Quraysh leaders met at Dar Al-Nadwa. Some proposed to shackle the Prophet’s (saws) his movement to prevent him from spreading Islam, others suggested assigning representatives from various tribes to collectively kill him (saws), hoping to disperse his blood among different tribes, a third plan involved exiling him (saws) from Mecca. They eventually agreed to select a strong man from each tribe to strike the Prophet (saws) simultaneously, causing his (saws) blood to scatter among the tribes. On the day of migration, they surrounded the Prophet’s (saws) house, but he exited while reciting the verse:
وَجَعَلْنَا مِن بَيْنِ أَيْدِيهِمْ سَدًّا وَمِنْ خَلْفِهِمْ سَدًّا فَأَغْشَيْنَاهُمْ فَهُمْ لَا يُبْصِرُونَ
(And We have put before them a barrier and behind them a barrier and covered them, so they do not see.) (Yaseen: 9)
This verse refers to the time when the disbelievers plotted secretly, contemplating whether to detain, kill, or exile the Prophet (saws).
( وَيَمْكُرُ اللَّهُ ) (and Allah plans): It is not appropriate to derive a Name for Allah from a mentioned action, such as saying: “Allah (swt) is a planner”, we should not forget that the Names of Allah (swt) are descriptive. Allah’s (planning) here refers to His (swt) Knowledge in their plot which will result in annulling it. So, while they plot, Allah (swt) frustrates their schemes. Thus, Allah is (swt) the Best of those who foil the schemes against His (swt) noble Messenger (saws).