JERUSALEM — In a dramatic courtroom twist, Moshe Katsav, the former president of Israel, backed out of a plea agreement on Tuesday that required him to admit to having committed sexual offenses against female employees.

The decision could lead to the spectacle of a long, sordid trial and possibly the reinstatement of rape charges that had been dropped in the plea bargain.

The court session was supposed to start proceedings on the deal that had been reached with the state prosecutor nine months ago. But Mr. Katsav told the court he had decided to go to trial to clear his name instead.

“I wish to fight for my innocence,” Mr. Katsav told a three-judge panel at the Jerusalem Magistrates Court, as his wife, Gila, and other family members sat on the bench by his side. “I want to put an end to this persecution.”

The announcement stunned many Israelis. In a statement after the court hearing, Attorney General Menachem Mazuz expressed amazement at the conduct of Mr. Katsav’s lawyers, who had told the prosecutor’s office of the decision to renege on the deal only an hour before the hearing.

“In any event, one must assume that the implications of this move are clear to Moshe Katsav,” he said.

There had been fierce public criticism of the deal, in which possible rape charges against the former president were dropped in exchange for an admission of guilt for lesser offenses, including committing an indecent act, sexual harassment of two employees and harassing a witness.

For months, Mr. Katsav’s lawyers and the state prosecutors defended the deal as the High Court of Justice considered six public petitions for its annulment. In late February, the High Court upheld the agreement, with the court’s five-judge panel split 3 to 2. Chief Justice Dorit Beinisch, in the minority, argued that the deal was seriously flawed.

According to its terms, Mr. Katsav was to serve no jail time, but receive a one-year suspended sentence and pay several thousand dollars in compensation to two women. He was also required to resign from the presidency last June, two weeks before his term was to expire.

After Mr. Katsav’s announcement, the prosecution and the court agreed to cancel the indictment that had been issued in the context of the plea agreement. Mr. Mazuz will reconsider the evidence against Mr. Katsav before filing a fresh indictment, with or without rape charges.

The prosecutors had previously argued that problems of evidence led them to a plea agreement in the first place.

Mr. Katsav has always maintained his innocence. Last June, his lawyers suggested that he agreed to admit to the lesser offenses only to spare his family the ordeal of a trial.

In court on Tuesday, Mr. Katsav said that he knew he was “choosing the hard way,” and that he was fully aware of the consequences. Leaving the courtroom, one of his lawyers, Avigdor Feldman, said his client could not “admit to charges he did not commit.”

Mr. Feldman said that he would continue to represent Mr. Katsav, and that the former president had made his decision in consultation with his lawyers, who “supported it.”

Zecharia Schenkolewski, a lawyer for a woman identified in the plea agreement only by the initial L., said that if necessary the woman would testify against Mr. Katsav in court. The woman, who worked in the president’s office, has accused Mr. Katsav of sexual misconduct and witness harassment.

It was Mr. Katsav’s first appearance in court, nearly two years after the allegations against him started coming out.

In the street outside the court, dozens of women and a few men demonstrated in white T-shirts printed with the slogan “We are all A.,” referring to the woman who first accused Mr. Katsav of rape, whose case was dropped in the plea deal.

There were shouts of “rapist” from the protesters as Mr. Katsav made his way into the small, packed courtroom, smiling wanly. He was holding hands with his wife, who was visibly upset.

Many had expected Mr. Katsav’s lawyers to seek some kind of delay. The hearing had already been postponed for two weeks, with the defense lawyers contending that they had not received some of the investigation materials from the prosecutor’s office.

Representatives of women’s groups expressed satisfaction that Mr. Katsav would go to trial, but said they had no way of knowing whether it was another stalling tactic by Mr. Katsav and his lawyers.

“We were against the plea arrangement to begin with,” said Miriam Schler, director of the Rape Crisis Center in Tel Aviv, who was among the protesters outside the courthouse. “We hope there can now be a fair trial.”

She said the ordeal that the women who filed the complaints against Mr. Katsav had gone through had already deterred many young women from complaining to the authorities about sexual crimes.

Mr. Katsav would be the first former head of state to go on trial in Israel. After resigning from the presidency, a mainly ceremonial post, he was succeeded by the elder statesman Shimon Peres.

Legal commentators said Mr. Katsav was taking a big risk by asking to go to trial. After the court hearing, one of the women’s lawyers said Mr. Katsav was “fighting for his life.”

Copyright 2008 The New York Times Company