If we were to break it down further, this concept can be extracted from Quran (5:48):
وَأَنزَلْنَا إِلَيْكَ الْكِتَابَ بِالْحَقِّ مُصَدِّقًا لِّمَا بَيْنَ يَدَيْهِ مِنَ الْكِتَابِ وَمُهَيْمِنًا عَلَيْهِ فَاحْكُم بَيْنَهُم بِمَا أَنزَلَ اللّهُ وَلاَ تَتَّبِعْ أَهْوَاءهُمْ عَمَّا جَاءكَ مِنَ الْحَقِّ لِكُلٍّ جَعَلْنَا مِنكُمْ شِرْعَةً وَمِنْهَاجًا وَلَوْ شَاء اللّهُ لَجَعَلَكُمْ أُمَّةً وَاحِدَةً وَلَـكِن لِّيَبْلُوَكُمْ فِي مَآ آتَاكُم فَاسْتَبِقُوا الخَيْرَاتِ إِلَى الله مَرْجِعُكُمْ جَمِيعًا فَيُنَبِّئُكُم بِمَا كُنتُمْ فِيهِ تَخْتَلِفُونَ
Then [O Prophet!] We have revealed to you this Book with truth in corroboration of the Book before it, and standing as a guardian over it. Therefore, give judgement among them according to the guidance revealed by God, and do not yield to their whims by swerving from the truth revealed to you. For each of you, We have ordained a shariah that is a line of action. Had God pleased, He could have made of you one community: [but he did not do this] because He wanted to try you by what He has blessed you with. So, try to outdo one another in good deeds. To God shall you all [one day] return. Then He shall disclose upon you all your differences.
______________________________
Please also refer to following threads:
Discussion 1369
Discussion 1906
Discussion 1374