Oscar Pistorius has been released on bail on charges that he murdered model girlfriend Reeva Steenkamp.
The Olympic and Paralympic athlete shot Steenkamp dead at his home on 14 February.
He told the court during the four-day bail hearing in Pretoria that he thought she was an intruder and had acted out of fear. In his testament, Pistorius told how he tried to save her life when he realised his mistake but she died in his arms.
Judge Desmond Nair deliberated over the decision for two-and-a-half hours before deciding to release the athlete until trial. A man could be in heard in the crowd cheering as Nair delivered his verdict.
Justifying his decision, Nair said: "The issue is not guilt, but where the interests of justice lie. I would venture to say, at this point, that I am not as much seized as finding beyond reasonable doubt that the applicant committed pre-meditated murder."
Although the judge also noted that "the state has nothing more than circumstantial evidence," and lamented the failings of Inspector Hilton Botha, who "made several errors and omissions under cross-examination" and "may well have contaminated the crime scene."
Regarding the contention that Pistorius would be a flight risk if bailed, Nair said: "He regards South Africa as his permanent place of abode, he has no intention of relocating, and he holds immovable property in South Africa... encumbered by a mortgage bond."
'No evidence to suggest premeditated murder'
Earlier Barry Roux, defending, had argued that there was no evidence to suggest premeditated murder, nor was there any reason to contest Pistorius's version of events.
He told the court that the defendant had been firing blindly through the locked bathroom door and was not aiming deliberately at the "intruder".
He assured the judge that the athlete was not a flight risk. Prosecutor Gerrie Nel had said there was good reason to believe that Pistorius might skip bail as his father and brother had visited his house after the shooting to look for documents relating to offshore accounts.
Nel said there was a risk Pistorius would flee to Italy, where the athlete said he had a house and spent four months of the year.
The judge had asked the prosecutor how a high-profile celebrity with no legs would be able to evade police, to which Nel said he could "wear long pants". Nel also said Julian Assange had managed to evade extradition from the Ecuadorean embassy in London for six months.
He said just because Pistorius was a celebrity, he should not be given special treatment.
Roux mocked Nel's argument, saying that every time the athlete goes through airport security it causes a commotion. It was impossible for Pistorius to disappear as he needs medical attention for his stumps and his prosthetic legs need constant maintenance.
The relatives of Steenkamp attended the hearing but they said they would not comment on the decision.