US supreme court justices appear ready to uphold the most controversial sections of Arizona's tough anti-illegal immigrant law after throwing a barrage of sceptical questions at the Obama administration's contention that the legislation is unconstitutional.

The court heard an appeal on Wednesday by the Arizona government against a federal court ruling that provisions of the Support Our Law Enforcement and Safe Neighbourhoods Act, also known as SB1070, encroached on powers held by the federal government.

The most hotly challenged element of the law requires police officers to check the immigration status of anyone they stop if it is suspected the person may be in the country illegally. Critics have said that will lead to racial profiling and the routine harassment of the large number of Latino US citizens living in Arizona.

Before the US solicitor-general, Donald Verrilli, began his arguments on behalf of the Obama administration's opposition to SB1070, the chief justice, John Roberts, asked whether the government contends that the law is illegal because it will lead to racial profiling. The solicitor general said no, even though that charge has led to denunciations of the legislation across the country and a boycott of Arizona that has cost it business.

That left the focus of the arguments over whether Arizona is usurping the powers of the federal government by wading into immigration law enforcement.

Verrilli told the court that SB1070's requirement for police officers to routinely check immigration status would lead to "mass incarceration" that is part of the Arizona government's policy to drive illegal immigrants out of the state.

The solicitor general said it is up to Washington to decide which illegal immigrants to arrest even if that means allowing some people to remain in the country illegally.

Verrilli also argued that the wholesale detention of illegal immigrants in Arizona who have not committed any crime would put an undue strain on government resources and force it to divert funds from more focused efforts to combat those involved with crimes such as drug trafficking.

The solicitor-general's claims were met with scepticism from several justices, who questioned why Arizona should not be free to uphold the law even if the federal government chooses not to.

"What is wrong about the states enforcing federal law?" asked Antonin Scalia. "The state has no power to close its borders to those who have no right to be there?"

The chief justice, John Roberts, poured scorn on Verilli's claim that it is acceptable for Washington to selectively uphold the law. "It seems to me the federal government just doesn't want to know who's here illegally and who's not," he said.

Roberts added that the Arizona law "doesn't require [the federal government] to remove one more alien" and was therefore not usurping its powers.

Paul Clement, acting for the Arizona government, came under strong questioning over whether someone subjected to an immigration check would be detained for lengthy periods. He said that the law required a police officer to check with the federal authorities whether a person is an illegal immigrant and if he should be detained. If the federal government did not want him held, he would be released. Arizona did not intend to deport anyone.

Clement to some degree undercut the claims of the legislation's authors by saying that the new law does not authorise Arizona police officers to do anything that they cannot already do anyway. He argued that if the action of the state government is not specifically barred by Congress then it's legal.

Justice Stephen Breyer said he did not see why simply notifying federal agents that the Arizona police were holding a possible illegal immigrant would be a problem.

One of the more liberal justices, Sonia Sotomayor, who the Obama administration would be looking to for support if its case is to prevail, also challenged Verrilli's logic. She questioned how the checking of the immigration status of detained individuals could be an infringement of federal powers if a police officer then releases those the government says it is not interested in holding or deporting.

"You can see it's not selling very well," Sotomayor told the solicitor-general about his argument.

But the justices appeared more sympathetic to the Obama administration's challenge to another part of the law which makes it a criminal offence for illegal immigrants to be in the state or to work there with prison sentences of up to 20 days for first offence.

"What they're going to do is engage, effectively, in mass incarceration," said the solicitor general. "It would be an extraordinary thing to put someone in jail merely for seeking work."

Verilli added that because people convicted of being illegal immigrants will still be committing a crime under Arizona law, they will face the prospect of perpetual arrest.

"They day they get out of jail for that 30 days, they can be arrested again, and this can happen over and over again. And the point of this is to drive unlawfully present people out of the state of Arizona," he said.