The U.S. Supreme Court struck down Monday key parts of an Arizona law that sought to deter illegal immigration, but let stand a controversial provision that lets police check a person’s immigration status while enforcing other laws.

In a decision sure to ripple across the political landscape in a presidential election year, the court’s 5-3 ruling upheld the authority of the federal government to set immigration policy and laws.

“The national government has significant power to regulate immigration,” Justice Anthony Kennedy wrote in the majority opinion. “Arizona may have understandable frustrations with the problems caused by illegal immigration while that process continues, but the state may not pursue policies that undermined federal law.”

The Supreme Court concluded that the federal government has the power to block the law — known as SB1070. Yet the court let stand one of the most controversial parts of the bill — a provision that lets police check a person’s immigration status while enforcing other laws if “reasonable suspicion” exists that the person is in the United States illegally.

President Obama shared the concerns of many when he stated that the law gives a legal excuse for racial profiling. 

“No American should ever live under a cloud of suspicion just because of what they look like,” Obama said. “Going forward, we must ensure that Arizona law enforcement officials do not enforce this law in a manner that undermines the civil rights of Americans, as the court’s decision recognizes.”