Due to the Supremacy Clause in the United States Constitution, federal law overrides state law in most cases. The Supremacy Clause is closely related to the idea of preemption.
According to the University of Missouri-Kansas City School of Law, preemption means that some issues are so important to the nation's well-being that the federal law should and must override state laws. For instance, during desegregation in the South, many states tried to pass laws to halt its progress. The Supreme Court ruled that such laws were unconstitutional in Cooper vs. Aaron. This court case basically established the precedent that any such law a state tries to pass to nullify a federal law is not constitutional.