The answer is: The Constitution
The constitution that each country have will always become a basis of what laws can be passed by the government in that country.
IN united states, all of the 50 states have the power to create their own law in order to maintain the order of each states' citizens. BUT, all the laws that they make cannot violate the constitution in any way. The same thing applied for the laws created by the federal government.
Because of this, we say that at the most fundamental level, this relationship is governed by the constitution.