Overall meaning :
Allah enjoins His believing servants to hand back their trusts to their rightful owners and to judge with justice whenever they judge between people. Excellent indeed is what He exhorts them to do. He hears and sees everything.
Then He instructs them to obey Him and obey His Messenger, may Allah bless him and grant him peace, and those in charge of their religious and worldly affairs, namely scholars and rulers, as long as their obedience to them does not interfere with their obedience to Allah and His Messenger and does not contravene their commands. If they differ on a religious matter, He further teachers, they should refer to His Book and the Sunnah of His Messenger, may Allah bless him and grant him peace, if they truly believe in Allah and the last Day. That is better for them and is equally better for their religion, their worldly life and their life to come.