What was Oscar Pistorius thinking?

For all the minute testimony in the South African athlete's murder trial — about dents in a door made by a cricket bat, positions of curtains, power cords and duvets in his bedroom, the forensics of bullet wounds — Pistorius' fate will largely be decided on how a judge views his state of mind.

Is he a volatile troublemaker who intended to kill his girlfriend, Reeva Steenkamp? Or was he a victim of extraordinary misfortune firing at a presumed intruder?

Pistorius, the first double amputee to compete in the Olympics, has said he thought a burglar had barricaded himself in a toilet cubicle, and fired four shots through the door, killing Steenkamp in the early hours of Valentine's Day last year.

Judge Thokozile Masipa will hear final arguments Thursday, then resort to a complicated body of law. The simplest verdict would be to agree with the prosecution that Pistorius intentionally shot his girlfriend while in a rage after an argument — making it murder.

But under South African law, firing with intent to kill can be ruled murder even if the defendant was mistaken about his target.

Masipa also could consider "culpable homicide," a criminal but unintentional killing in which Pistorius, a trained gun expert, did not foresee the consequences of firing Black Talon expanding bullets through a door and into the small cubicle.

A similar defense did not help hip-hop star Molemo "Jub Jub" Maarohanye. A judge in his case ruled that he must have foreseen that drag racing on a crowded street near a school could kill people. Four boys died and two others were left with brain damage when his car struck them. He was convicted of murder.

Pistorius' advocate, Barry Roux, has aired several defenses, each mutually exclusive, leaving even legal experts confused — and intrigued.

Although the circumstances of the case preclude a claim of self-defense under South African law, Pistorius could claim "putative private defense": that he believed he was acting lawfully and reacting reasonably to a perceived threat to his life.

Most experts thought Roux had that defense in mind, until Pistorius took the stand. Many experts regarded Pistorius as a poor witness because of contradictions and inconsistencies under cross-examination. His story didn't jibe with crime scene photographs showing the position of objects in the bedroom, including a fan and duvet.

Pistorius told the court he was so terrified that he acted unconsciously: He didn't aim at the door, didn't consciously pull the trigger and never thought he would kill anyone. Believing there was a burglar in the home, he armed himself and moved toward the door — all the time knowing exactly what he was doing. Yet, at the moment he pulled the trigger, intentional, conscious action evaporated, Pistorius testified.

"Before I knew it, I had fired four shots at the door," Pistorius told the court.

Roux could use self-defense or several other arguments in framing his final argument on Pistorius' behalf.

To convict Pistorius, "You need to be convinced that there's no reasonable possibility that he could have been lingering under the mistake that there was an intruder in the house and that he had to kill this intruder," said James Grant, a criminal law expert at Witwatersrand University.

Despite the apparent weight of evidence against him, Pistorius' state of mind is "all important," Grant said. "That's why it's so difficult to call."

Pistorius' final defense witness, sports medicine expert Wayne Derman, told the court that extreme anxiety and a diminished ability to defend himself left Pistorius with a hair-trigger startle reflex. His testimony raised a potentially precedent-setting question for South Africa, according to legal analysts: Did being disabled and unable to flee leave Pistorius so vulnerable and terrified that he lost control of his actions and unintentionally pulled the trigger?

Derman testified that the startle responses of disabled athletes were exaggerated compared with those of non-disabled people. Because Pistorius couldn't flee, he had to confront danger, an option that may not have been reasonable for an able-bodied person who could have run away, Derman testified.

Legal analysts said it was the first time a South African court has been confronted with a defense of unconscious, involuntary action based on an exaggerated startle response due to disability. Courts have tended to dismiss such a defense except in extraordinary cases involving sleep walking or epilepsy.

One more long-shot defense is available, however. South African law recognizes temporary insanity (technically known as temporary non-pathological criminal incapacity) in cases in which a killer is so emotionally overwhelmed by terror, rage or other emotions that he briefly loses control and acts unconsciously and involuntarily.

"The evidence of Derman is very much along the lines that his startle response made it impossible for him to understand that he was doing wrong or to control himself," Grant said.

The last South African who tried the temporary insanity defense failed. Graeme Eadie, who beat a motorist to death with a hockey stick after the driver tailgated him at night, flashed his headlights, overtook and cut him off, argued that marital, financial and work stress provoked his temporary non-pathological criminal incapacity. Eadie lost the case and an appeal.

David Dadic, an attorney and criminal law expert, said the defense made a strong case Pistorius was extremely fearful and vulnerable. But the court might conclude that many other people have been similarly fearful, but did not react the same way, he said.

"I think the court will be wary of the precedent," Dadic said. "We can't create a precedent in this country where you can go and shoot down bathroom doors because you are scared."

Another attorney, Ulrich Roux, who is not related to Pistorius' advocate, said he didn't think that Derman's testimony about Pistorius' startle response would sway the court.

"I don't believe it's possible for the startle to have lasted for the entire time from the moment that he woke up, heard a noise, got his gun, went to the bathroom and fired four shots," Ulrich Roux said. "At some time his mind must have said: What am I doing? What is that noise? Where is Reeva? What is going to happen if I fire through the door?"

But Pistorius could go free if the court finds both that there was reasonable doubt that he foresaw the shots would kill, and that firing four shots was reasonable for a fearful, anxious man who couldn't flee, Grant said.

"I don't know how the court will make a decision," Grant said. "I think it's incredibly difficult in issues like this, where the defense is exclusively subjective: What was he actually thinking?"