ST. POELTEN, Austria In a stunning turn of events, an Austrian on trial for imprisoning his daughter for 24 years and fathering her seven children pleaded guilty Wednesday to all charges against him including homicide. The move came after his daughter appeared unexpectedly in the courtroom this week.

Surprising even his lawyer, Josef Fritzl calmly acknowledged his guilt on the third day of a trial that has drawn worldwide media attention for its shocking allegations.

“I declare myself guilty to the charges in the indictment,” Fritzl, 73, told a panel of judges, referring to what he called “my sick behavior.”

Fritzl had been charged with homicide, enslavement, rape, incest, forced imprisonment and coercion. Initially he had only pleaded guilty to incest and forced imprisonment. The change of plea means he could face up to life in prison for the negligent homicide charge literally “murder by neglect” in German.

Fritzl’s daughter Elisabeth was the prosecution’s key witness against him. Now 42, she was 18 when he imprisoned her in the cramped, windowless cell he built beneath the family’s home in the town of Amstetten. He then raped her for years.

Asked by the presiding judge what had led him to change his mind, Fritzl said it was the testimony from Elisabeth. Fritzl, jurors and others in court had viewed 11 hours of her videotaped statement during closed-door sessions Monday and Tuesday but officials were not allowed to discuss what happened in those sessions.

Fritzl’s lawyer, Rudolf Mayer, said Fritzl had asked to see a psychiatrist after Tuesday’s court hearing.

“It must really have shaken him up,” he said, referring to Elisabeth’s testimony.

However, a person familiar with the trial told The Associated Press that Elisabeth herself was in the courtroom on both days when the public and media were excluded suggesting her presence alone might have unnerved Fritzl and prompted him to change his pleas.

The person spoke on condition of anonymity because he was not authorized to discuss the closed-door proceedings.

Before the trial, prosecutors had said Elisabeth would not be present and would testify only through prerecorded remarks.

Court spokesman Franz Cutka said Elisabeth was not in court Wednesday. He seemed to confirm she was in court earlier this week by saying neither he nor the president of the court personally greeted her.

The homicide charge came for the death of an infant twin boy Michael born to Elisabeth in April 1996 who prosecutors say might have survived with proper medical care had he and his mother not been locked in the basement.

Elisabeth and her six surviving children, who range in age from 6 to 20, have spent months recovering from their ordeal in a psychiatric clinic and at a secret location. Prosecutors have described her as a “broken” woman.

Psychiatrist Adelheid Kastner told the court Wednesday that Fritzl had a very serious personality disorder and would pose a threat to others even at his advanced age if freed. She recommended that Fritzl serve out his sentence in a special prison for psychologically deranged criminals.

Fritzl expressed regret that he didn’t bring the ailing infant out of the dungeon and get medical help.

“I don’t know why I didn’t help,” Fritzl said. “I just overlooked it. I thought the little one would survive.”

“I should have recognized that the baby was doing poorly,” he added.

Mayer, his lawyer, had previously claimed that Fritzl only saw the newborn once it was already dead.

Wearing a mismatched suit and a blue shirt, Fritzl did not hide his face behind a binder Wednesday as he had done for the last two days when led into the courtroom in St. Poelten, west of Vienna.

After the plea change, the psychiatrist’s testimony and brief consideration of reports about the cellar, officials adjourned the trial until Thursday morning.

Legal experts say the jury will still have to deliver a verdict despite Fritzl’s guilty pleas, although his confessions are grounds for a lesser sentence. The verdict and sentence for Fritzl are expected Thursday after closing statements from both sides.

Mayer said he had not been aware of Fritzl’s change of heart before Wednesday’s court session. “He didn’t discuss it with me,” he said.

Erich Huber-Guensthofer, deputy head of the St. Poelten prison, said Fritzl had an “extensive conversation” with a psychiatrist after Wednesday’s court hearing.

Police say DNA tests prove Fritzl is the biological father of all six of Elisabeth’s surviving children, three of whom never saw daylight until the crime came to light 11 months ago.

Three of the children grew up underground in Amstetten and the other three were brought upstairs to be raised by Fritzl and his wife, Rosemarie, who apparently believed they had been abandoned.

Prosecutors have alleged that Fritzl refused to speak to his daughter during the first few years of her ordeal, coming downstairs only to rape her. They said the rapes sometimes occurred in front of the children.

Kastner, the psychiatrist who met with Fritzl several times and wrote a psychological profile for the court, said the Austrian had a deep need to control people. She said Fritzl had an ability to block out his crimes but knew what he was doing was wrong, acknowledging he had a guilty conscience when he went to bed at night and when he woke up in the morning.

“Fritzl is guilty for what he did,” she said, adding he also believed “he was born to rape.”

She said the large number of children Fritzl fathered only strengthened the control he had over his victim. “The more children, the more power,” Kastner said. “This is about possession … power … control.”

Fritzl had testified earlier this week that he had a difficult childhood and a bad relationship with his mother.

“The climate in his parent’s house was marked by fear,” Kastner said.

The Associated Press normally withholds the names of victims of sexual assault. In this case, the withholding of Elisabeth’s name by the AP became impractical when her name and her father’s were announced publicly by police and details about them became the subject of publicity both in their home country and around the world.