The US Supreme Court has begun reviewing a case by Muslims in the United States who were detained in the immediate aftermath of the September 11, 2001, attacks.

The court on Wednesday reviewed whether the men had the right to sue top US officials including attorney general at the time John Ashcroft and FBI director Robert Mueller, for their allegedly illegal detention.

The men say they were held after the attacks on the World Trade Center and The Pentagon based solely on their identity as Arab Muslims.

They were among 750 Muslims rounded up after the attacks, many on grounds that they did not have legal US immigration papers.

US releases classified 9/11 report pages

They said they were held in small isolation cells for up to 23 hours at a stretch and subjected to mental and physical abuse. They were held in detention for three to eight months.

A lower court had ruled in the men's favour, and the officials appealed that to the Supreme Court, arguing that the national security and immigration requirements of the time justified the sweeping arrests.

A ruling on whether the men had a right to sue rests on court precedents involving constitutional protections against illegal search and seizure.

Justice Stephen Breyer got to the heart of the broader case: whether the atmosphere at the time justified such a broad reaction.

"I can understand after a bomb attack and 3,000 people are killed," Breyer said. "I can understand that the first reaction of the law enforcement authorities is pick up anybody you might think is connected, and we'll worry about the rest of it later."

"Now, eight months? ... The answer is pick up anybody who might have a connection, and then just keep them there?" he asked.

The outgoing Barack Obama administration came in on the side of Ashcroft, Mueller and the others being sued.

Ruling expected in June

"This is something that was done as the officials are trying to sort through how to respond to the very difficult situation," said Justice Department lawyer Ian Gershengorn.

"Some of the people on the list had ties to terrorism - may have had ties to terrorism. Some of them may well not have," he said.

But officials needed time to make a decision, and in the meanwhile did not violate any laws, including those on discrimination, he said.

But Rachel Meeropol, arguing for the men who had been detained, said it was an issue of illegal discrimination.

"This court has a historic role to play in ensuring that race and religion do not take the place of legitimate grounds for suspicion and in deterring future federal officials from creating government policy to do the same," she said.

The lawyer for the former officials argued they should be considered immune from such cases. A ruling is due by the end of June.