The saying of the Exalted: "And thus We have made you a median nation," meaning: just; that is, the nation of Muhammad, "that you may be witnesses over the people" on the Day of Resurrection, that the messengers have conveyed to their people on behalf of their Lord, "and the Messenger may be a witness over you," that he has conveyed the message of his Lord to his nation. This is the interpretation of Qatada.
Muhammad said: Some of them recited:
(They are median, the people are pleased with their judgment … when one of the great calamities of the nights descends)
Meaning: 'Median' as in just and chosen.
The saying of the Exalted: "And We did not make the qiblah which you were upon"—meaning: Bayt al-Maqdis—"except that We might make evident"—meaning: the knowledge of one's actions—"who would follow the Messenger from those who would turn back on their heels. And indeed, it was difficult except for those whom Allah has guided," meaning: the changing of the qiblah. Qatada said: "The qiblah was a trial and a purification. The Messenger of Allah (peace and blessings of Allah be upon him) prayed toward Bayt al-Maqdis during the period of his stay in Mecca, and the Ansar prayed toward Bayt al-Maqdis for two years before the arrival of the Prophet (upon him peace) to Medina. The Prophet (peace and blessings of Allah be upon him) prayed toward Bayt al-Maqdis for sixteen months after his arrival in Medina, then Allah (may He be glorified and exalted) directed him after that toward the Kaaba. So, some said: 'What has turned them away from their qiblah which they were upon?' For a man indeed yearned for his birthplace."
The saying of the Exalted: "And never would Allah have caused your faith to be wasted," meaning: your prayer toward Bayt al-Maqdis. Qatada said: When the qiblah was changed, a people said: "What about our deeds which we were..."