Countries with individual states often have legal codes for each state. These are separate from whole-country laws, and although many of them are similar, some laws are in opposition to whole-country statutes. State law speaks to many different legal areas and often establish the state’s governance structure, a criminal code, and civil statutes. People residing in the state or even visiting have to obey state law.
The federal and state law structure in the US is a good model for understanding state laws. Even when the states were colonies, it was recognized that each area needed to be able to independently govern to some extent, no matter what other government it might obey. The small matters of everyday living in a certain locale are usually best handled locally, especially in areas that comprise a huge geographic space, and particularly when travel to those areas took months.
When Britain controlled colonies in America, it would have been difficult for it to be directly involved in all everyday affairs, and a system of having laws for each colony or even smaller areas made sense. The administrators of these laws were often directly tied to British government, and given any colonial resistance, new oppressive laws could easily be written.
In creating the US, concern existed about a strong, central government that would oppress each state, so states were given a lot of freedom in constructing their own laws. Position on this has shifted throughout the centuries, with the federal government sometimes overriding state laws and other times minimizing involvement in them. One change from colonial legal structures is that state residents participate in state law creation, which was seldom a right of most colonists.
It’s hard to decide when people are subject to federal or state law. In some cases, no matter the state, federal statutes apply. For instance, federal income tax laws apply to all citizens, and certain constitutional rights can’t be overridden by a state. Many everyday legal matters, like those involving divorce or child custody, are state governed, and the majority of crimes committed within a state are prosecuted according to that state’s laws. The federal government prosecutes crimes that occur over more than one state.
There are noted discrepancies between federal and state law on similar issues. For example, some of the state statutes that permit medical marijuana use conflict with federal laws, and people in possession of marijuana could be acting in compliance with state standards, while violating federal ones. The federal government determines if it will ignore purposeful violation of its rules, or not, and this may change with different political groups in power.
Also, states don’t necessarily have to honor each other’s laws. Drivers from California have found this out when receiving tickets for making right turns against a red light in Nevada. Married same-sex couples in one state aren’t necessarily married in another. Basic property rights in a divorce may change based on state residence.