MUMBAI, India - The accused gunman in last year's bloody siege of Mumbai retracted his detailed confession yesterday, saying police tortured him into admitting his role in the attacks that left 166 people dead.

Mohammed Ajmal Kasab, 21, who was photographed carrying an assault rifle during the attack on Mumbai's main train station, told the judge he came to Mumbai as a tourist and was arrested 20 days before the siege began.

On the day the attacks started, Kasab said, police took him from his cell because he resembled one of the gunmen, shot him to make it look like he had been involved in the violence, and rearrested him.

The prosecution brushed off Kasab's statements. "All the while, I expected that Kasab was about to take a U-turn in the case," said prosecutor Ujjwal Nikam. "It's not going to affect our case."

In Kasab's confession, he spoke of spraying gunfire into the crowd at the train station and described in detail a network of training camps and safe houses across Pakistan, revealing the names of four men he said were his handlers.

But yesterday, he said police tortured him into falsely confessing. The assault 13 months ago lasted nearly three days. During the attacks, 10 young men armed with assault rifles stormed two luxury hotels, a Jewish center, and the train station. Nine gunmen were killed, and Kasab was wounded.

Kasab told the court that he was initially arrested last year after wandering around Mumbai late at night looking for a place to stay, and that his Pakistani citizenship aroused suspicion.

After he was rearrested for the Mumbai attack, he said, four white men came to visit him in jail, including David Coleman Headley, who is jailed in Chicago on charges he conspired in the siege. The judge then stopped Kasab and told him not to reveal any more details on Headley.

Headley, 49, a U.S. citizen whose father was Pakistani and mother a Philadelphia socialite, was arrested Oct. 3 as he was about to board a plane for Philadelphia.

Kasab's statement yesterday was not his first reversal. In February, he told a judge he wanted to attack India in order to free the divided region of Kashmir. He later recanted. In July, he suddenly confessed, saying he would rather be hanged in this world than face "God's punishment" in the next.