Allah the almighty says in the Quran

"Whoever obeys the Messanger, obeys Allah" Allah says, "No, by your Lord, they do not believe until they submit to your adjudication in all disputes between them, then they do not find themselves oppressed with your decisions and they completely submit."

(surah 4:65)