فَبَدَاَ بِاَوْعِيَتِهِمْ قَبْلَ وِعَاۤءِ اَخِيْهِ ثُمَّ اسْتَخْرَجَهَا مِنْ وِّعَاۤءِ اَخِيْهِۗ كَذٰلِكَ كِدْنَا لِيُوْسُفَۗ مَا كَانَ لِيَأْخُذَ اَخَاهُ فِيْ دِيْنِ الْمَلِكِ اِلَّآ اَنْ يَّشَاۤءَ اللّٰهُ ۗنَرْفَعُ دَرَجَاتٍ مَّنْ نَّشَاۤءُۗ وَفَوْقَ كُلِّ ذِيْ عِلْمٍ عَلِيْمٌ ( يوسف: ٧٦ )
Fabada-a bi-aw'iyatihim qabla wi'aaa'i akheehi summas takhrajahaa minw wi 'aaa'i akheeh; kazaalika kidnaa li Yoosuf; maa kaana liyaakhuza akhaahu fee deenil maliki illaaa any yashaaa'al laah; narfa'u darajaatim man nashaaa'; wa fawqa kulli zee 'ilmin 'Aleem (Yūsuf 12:76)
Sahih International:
So he began [the search] with their bags before the bag of his brother; then he extracted it from the bag of his brother. Thus did We plan for Joseph. He could not have taken his brother within the religion [i.e., law] of the king except that Allah willed. We raise in degrees whom We will, but over every possessor of knowledge is one [more] knowing. (Yusuf [12] : 76)
1 Mufti Taqi Usmani
So, he started with their bags before (searching) the bag of his brother, then, recovered it from the bag of his brother.This is how We planned for Yūsuf. He had no right to take his brother according to the law of the king, unless Allah so willed. We elevate in ranks whomsoever We will. Above every man of knowledge, there is someone more knowledgeable.