South African athlete Oscar Pistorius, who faces murder charges over the fatal shooting of his girlfriend, has been granted bail after a four-day hearing.
Magistrate Desmond Nair said the state had not made a case that he would flee, or that he had a violent character.
The Paralympic sprinter denies murder, saying he shot Reeva Steenkamp thinking she was an intruder at his home.
The next hearing in the case has been set for 4 June. Bail was set at 1m rand (£72,000; $113,000).
He was ordered to hand over his passport, avoid his home in Pretoria and report to a police station between 07:00 and 13:00 every Monday and Friday.
Mr Nair took almost two hours to deliver his judgement.
He criticised the testimony of detective Hilton Botha, saying he had not followed up important leads and had changed his testimony.
But the magistrate also said he had difficulty understanding why Mr Pistorius had opened fire in the way he did.
However, he said Mr Pistorius had “reached out to meet the state’s case” and had given a full version of events at an early stage.
Mr Pistorius’s family and supporters in the court gasped and cheered as the magistrate announced he would be freed on bail.
The hearing began on Tuesday and both prosecution and defence laid out their cases.
Prosecutors allege Mr Pistorius murdered his girlfriend after an argument at his Pretoria home on 14 February.
Det Botha told the court that witnesses had heard shouting, screaming and gunfire from about 600m (2,000ft) away.
But later he changed his evidence to suggest the witnesses were much closer.
And on Thursday it emerged that Det Botha faces allegations of attempted murder, and he was removed from the case.
Mr Pistorius says he mistook his girlfriend for an intruder and shot her by accident.
Ms Steenkamp, 29, was a model and law graduate with a burgeoning television career.