The only survivor among the gunmen accused of killing more than 160 people here in November offered a dramatic and unexpected confession in the Mumbai court where he was being tried Monday, reversing months of denials, the prosecution said. Moments before the trial's 135th witness was to take the stand, the gunman, Ajmal Kasab, stood up and told the judge that he pleaded guilty to carrying out the attacks. Amid gasps from the courtroom, he gave a detailed recounting of the planning and execution of the operation, beginning with the group's departure from Pakistan and ending with the rampage that hit five-star hotels, a Jewish center, a railway station and popular cafe. Speaking to reporters, Ujjwal Nikam, one of the prosecutors, said that the “cat has come out of the bag.” He added: “We will analyze his statement and the argue the case. This is a big victory of prosecution.” Indian and American investigators say that a Muslim extremist group, Lashkar-e-Taiba, planned the attacks in Pakistan. Pakistan Foreign Ministry spokesman Abdul Basit declined to comment on Kasab's court admission. Late last month the special court also issued arrest warrants for 22 Pakistani nationals accused of masterminding the attacks. The founder of Lashkar-e-Taiba., Hafiz Mohammed Saeed, was arrested with two other senior figures by Pakistani authorities in December. A court in the eastern Pakistani city of Lahore freed Saeed in June saying there was no evidence against him. The federal government will appeal the verdict. In his statement Monday, Kasab named Saeed as a conspirator. Since November, relations between India and Pakistan, which have always been troubled, have been in a deep freeze. But in the past few weeks the mood has thawed, most recently with a meeting between the prime ministers of the two countries in Egypt that seemed to raise the possibility of renewed talks. Pakistan handed over a dossier last week to the Indian government with more information on the involvement of Lashkar operatives based in Pakistan. It was not immediately clear what the legal significance of Kasab's guilty plea would be. His court-appointed lawyer, S. G. Abbas Kazmi, has had severely limited access to Kasab and has struggled to put together an effective defense. The confession appeared to be a surprise to everyone in the court, including his court-appointed lawyer. Kazmi has not been allowed to talk to his client more than 15 minutes a day and has been able to do so only in the presence of police and court officials. The Indian authorities have previously said that Kasab confessed to being one of the terrorists after he was arrested. But his defense lawyer had moved to quash that confession, because Kasab asserted that he had been tortured by the police into making that statement. The court has not ruled on the admissibility of the previous confession. Ashok Chavan, the chief minister of Maharashtra state, of which Mumbai is the capital, welcomed Kasab's guilty plea and told the NDTV news channel: “All those involved in the 26/11 attacks should be hanged.”