Al-Anfal: 26
{And remember when you were...}
The grammatical case of {when you were} (idh antum) is the accusative (nasb) as a direct object (maf‘ul bihi) for the verb "remember," not as an adverb of time (zarf). It means: Remember the time of your being:
{In the land}
The land of Mecca before the migration, where the Quraysh oppressed you.
{Fearing that the people might abduct you}
Because all the people were enemies to you, opposing and antagonistic.
{But He sheltered you}
In Medina.
{And supported you with His victory}
By the backing of the Ansar and the reinforcement of the angels on the day of Badr.
{And provided you with good things}
From the spoils of war.
{That you might give thanks}
Meaning: The intention is that you should be grateful for these blessings.
Qatada said: This tribe of Arabs was the most humiliated of people, the most miserable in livelihood, the most naked in skin, and the most manifest in misguidance. They were consumed [by others] and did not consume. Then God established them in the lands, expanded their provision and spoils, and made them kings.
{O you who have believed, do not betray God and the Messenger, nor betray your trusts while you know.}