"Why would (Pistorius) venture further into danger" by going into the bathroom at all, Nair asked.
Cries of "Yes!" went up from Pistorius' supporters when Nair announced his decision to a packed courtroom after a nearly two-hour explanation of the ruling.
Nair set bail at 1 million rand ($113,000), with $11,300 in cash up front and proof that the rest is available. The 26-year-old track star was also ordered to hand over his passports, turn in any guns he owns and keep away from his upscale home in a gated community in Pretoria, which is now a crime scene.
He cannot leave the district of Pretoria without his probation officer's permission and is not allowed to consume drugs or alcohol, the magistrate said. His next court appearance was set for June 4.
Earlier, Pistorius alternately wept and appeared solemn and composed, especially as Nair criticized police procedures in the case and as a judgment in the track star's favor appeared imminent. He showed no reaction as he was granted bail.
Pistorius left the courthouse in a silver Land Rover just over an hour after the bail conditions were set. The vehicle, tailed by motorcycles carrying television cameramen, later pulled into the home of Pistorius' uncle.
"We are relieved at the fact that Oscar got bail today, but at the same time we are in mourning for the death of Reeva, with her family," said Pistorius' uncle, Arnold Pistorius. "As a family, we know Oscar's version of what happened on that tragic night and we know that that is the truth and that will prevail in the coming court case."
Dozens of journalists and international and local television crews had converged on the red-brick courthouse to hear the decision a sign of the global fascination with a case involving a once-inspirational athlete and his beautiful girlfriend, a law school graduate and budding reality TV show contestant.
Nair said Pistorius' sworn statement, an unusual written account of what happened during the pre-dawn hours of Feb. 14, had helped his application for bail.
"I come to the conclusion that the accused has made a case to be released on bail," Nair said.
Pistorius said he shot Steenkamp accidentally, believing she was an intruder in his house. He described "a sense of terror rushing over" him and feeling vulnerable because he stood only on his stumps before opening fire.
Prosecutors say he intended to kill Steenkamp as she cowered in fear behind the locked bathroom door after a loud argument between the two.
Yet despite poking holes in Pistorius' version of events and bringing up incidents they say highlight his temper, the state's case started to unravel during testimony by the lead investigator, Detective Warrant Officer Hilton Botha.
Botha, who faces seven charges of attempted murder in an unrelated incident, was removed from the case Thursday. His replacement, the nation's top detective, Vinesh Moonoo, stopped by the hearing briefly Friday.
While Nair leveled harsh criticism at Botha for "errors" and "blunders," he said one man does not represent an investigation and that the state could not be expected to put all "the pieces of the puzzle" together in such a short time.
The prosecution accepted the judge's decision without protest. "We're still confident in our case," prosecution spokesman Medupe Simasiku said.
Pistorius faced the sternest bail requirements in South Africa because of the seriousness of the charge, which carries a life sentence if convicted. His defense attorneys had to prove that he would not flee the country, would not interfere with witnesses or the case, and his release would not cause public unrest.
Nair questioned whether Pistorius would be a flight risk when he stood to lose a fortune in cash, cars, property and other assets. Nair also said that while it had been shown that Pistorius had aggressive tendencies, he did not have a prior record of offenses for violent acts.
Anticipating the shape of the state's case at trial, he said he had serious questions about Pistorius' account: Why didn't he try to locate his girlfriend if he feared an intruder was in the house? Why didn't he try to determine who was in the bathroom before opening fire? And why did he venture into perceived "danger" in the bathroom when he could have taken other steps to ensure his safety?
"There are improbabilities which need to be explored," Nair said, adding that Pistorius could clarify these matters by testifying under oath at trial.
Sharon Steenkamp, Reeva's cousin, said the model's family would not be watching the bail decision and had not been following the hearing.
"It doesn't make any difference to the fact that we are without Reeva," she told The Associated Press.
Before the hearing, Pistorius' longtime coach, Ampie Louw, said he hoped to put the runner back into his training routine if he got bail.
"The sooner he can start working the better," said Louw, who persuaded the double-amputee to take up track as a teenager a decade ago. But he acknowledged Pistorius could be "heartbroken" and unwilling to immediately pull on the carbon-fiber running blades that earned him the nickname "Blade Runner."
AP Sports Writer Gerald Imray contributed to this report from Johannesburg.
Jon Gambrell can be reached at www.twitter.com/jongambrellAP .