Part of a tough Arizona immigration law giving police powers to check the immigration status of people stopped and arrested has been upheld by the US Supreme Court.
However, three of four challenges brought by the Obama administration were upheld by the court.
Arizona’s Governor Jan Brewer said the “heart” of the law had been upheld.
President Barack Obama and his Republican rival Mitt Romney are each battling for Hispanic votes ahead of November’s presidential election.
Mitt Romney reacted quickly to the court’s ruling, criticizing Barack Obama for not passing a national immigration-reform law.
In a statement, he said each US state has “the duty – and the right – to secure our borders and preserve the rule of law”.
In other developments at the court on Monday:
• A ruling on President Barack Obama’s landmark healthcare reform law was scheduled for Thursday
• The justices rejected mandatory sentencing of juveniles convicted of murder to life in prison without parole
• The court struck down a Montana campaign finance law that would limit corporate contributions to political campaigns
The Supreme Court judgement came after the US government argued that the law infringed on federal rights to oversee immigration policy.
Alabama, Georgia, Indiana, South Carolina and Utah have all adopted variations of the Arizona law.
The headline provision, known as Section 2(B), that requires police to make a “reasonable attempt… to determine the immigration status” of anyone who is stopped for another violation, was upheld by the Supreme Court.
The court ruled it was too early to tell whether the clause caused a conflict with federal laws, but added that the provision could be open to legal challenge again at a later date.
The Supreme Court also struck down three other parts of the Arizona immigration law.
One clause would have required immigrants to carry proof of their status with them, and another would have made it a crime for undocumented workers to apply for a job.
The court also struck down a provision that would have allowed police to stop people purely on the suspicion that they were in the country illegally.
Justice Anthony Kennedy, who wrote the opinion for the court, said the justices were unanimous in their decision to allow the “check your papers” provision to come into effect. The court was divided on other issues.
One justice, Antonin Scalia, dissented from the case, saying he would uphold all parts of the Arizona law, citing the sovereignty of individual states as defined in the US constitution.
Arizona’s Republican governor, Jan Brewer, called the court’s ruling a victory, saying the “heart” of the bill could now come into effect.
In a statement, Jan Brewer said the ruling was a victory for “all Americans who believe in the inherent right and responsibility of states to defend their citizens.
But she warned against misuse of the provision, adding: “Law enforcement will be held accountable should this statute be misused in a fashion that violates an individual’s civil rights.”
Other reaction to the law was nuanced, and at least partly open to interpretation: some claimed victory for backers of the law, while others saw the ruling as a partial victory for the administration.
Immigration has become a key issue as the US edges closer to this year’s presidential election.
President Barack Obama recently outlined a plan to allow hundreds of thousands of illegal immigrants who came to the US as children the option of legal status and work permits.
His Republican rival Mitt Romney has opposed Barack Obama’s plan, but has not said how he would address the issue of immigration.
Both men are courting Hispanic votes ahead of their showdown in November.