It is necessary, first, to distinguish the function of a legislature from the function of a court. Legislatures formulate laws.
Courts interpret and apply laws to specific cases.
The purpose of formulating laws is to enunciate the rights of people, making it possible for the government to protect those rights by law enforcement. Law-making sometimes involves the spelling out of peoples' obligations toward respecting the rights of others. Among the rights and obligations of people are some which pertain to them as individuals and some which pertain to them as members of a civic community. In the United States, people belong to several legally established communities, but the nation and the state are the only ones considered here. Each community has its legislative bodies and its courts.