Oscar Pistorius stood in the dock in the Pretoria court on Friday. Reuters

PRETORIA, South Africa— Oscar Pistorius, the double-amputee Olympic athlete accused of murder, won bail on Friday, closing a contentious pretrial hearing that outlined sharply different versions of how his girlfriend died in his bathroom in the early hours of Valentine's Day.

Olympic athlete Oscar Pistorius was granted bail on Friday, having been charged with premeditated murder of his girlfriend. Devon Maylie has the latest on Lunch Break. Photo: AP.

Listen to the courtroom audio of the moment Olympic athlete Oscar Pistorius was granted bail on Friday. Photo: AP Images.

Magistrate Desmond Nair told a packed courtroom that he concluded Mr. Pistorius didn't pose a risk to flee the country, and wasn't likely to try influence witnesses. He then set bail at 1 million rand ($112,400), with $11,300 in cash and proof that the rest is available. He said Mr. Pistorius must hand over his passports and turn in any other guns that he owns. Mr. Pistorius cannot leave the district of Pretoria without the permission of his probation officer, the magistrate said.

When the bail announcement was made, members of Mr. Pistorius's family shouted in approval. Mr. Pistorius then left the courtroom with a slight smile.

"As the family, we are convinced that Oscar's version of what happened on that terrible night will prove to be true," the athlete's uncle, Arnold Pistorius, said after the bail hearing.

The magistrate set the next court appearance for June 4. A judge will hear Mr. Pistorius murder case; South Africa doesn't use the jury system and doesn't have the death penalty.

The four-day bail hearing encapsulated the arguments from both sides, highlighting the state's challenge of convicting Mr. Pistorius of premeditated murder and his defense team's task of showing the death of girlfriend, the model Reeva Steenkamp, was a tragic accident.

The state has alleged Mr. Pistorius, known as "Blade Runner" for the J-shaped artificial limbs he used on the track, fired shots through a closed bathroom door in fit of fury following an early morning argument on Feb. 14. If convicted of the charge, Mr. Pistorius could face life in prison.

Mr. Pistorius's legal team says the disabled athlete thought there was a burglar inside his Pretoria home, and feared for his safety. In an affidavit read by his lawyer, Mr. Pistorius acknowledged shooting Ms. Steenkamp, but said he was horrified to learn that it was she—and not a burglar—who was behind the closed bathroom door.

The state prosecutor, Gerrie Nel, and Mr. Pistorius's lawyer, Barry Roux, sparred throughout the week, each seeking to poke holes in the other's starkly different version of events.

Mr. Nel said it didn't make sense that a man, fearful for his safety, would rush to the bathroom and fire shots through the door before checking where Ms. Steenkamp was located.

Mr. Roux, in previous days' arguments, criticized the lead investigator for not thoroughly checking phone records and potentially contaminating the crime scene by not wearing protective footwear.

In a boost for the defense, the lead investigator, Hilton Botha, was removed from the case on Thursday after attempted murder charges against him were reinstated earlier in February. The charges relate to an incident in 2011 when Mr. Botha and two other officers allegedly fired their weapons at a moving minibus in an attempt to stop the driver. No one was killed.

South African police have tapped the force's top detective, Lt. Gen. Vinesh Moonoo, to take over as lead investigator into the murder of Ms. Steenkamp.

A spokeswoman for South Africa's National Prosecuting Authority said they welcomed Mr. Botha's removal from the case, but acknowledged that the new investigation team has a lot of work to do to shore up its argument that Mr. Pistorius intended to kill his girlfriend.

"The magistrate pointed us to where the challenges are," said the spokeswoman, Bulelwa Makeke.

Mr. Pistorius's success on the sports track—he was the first disabled runner to compete against able-bodied athletes at the Olympic Games in London—won him adulation at home in South Africa and a raft of overseas commercial endorsements. But the public spotlight for Mr. Pistorius has been much tougher of late.

The African National Congress Women's League this week criticized what it considered favorable treatment of Mr. Pistorius for allowing him to stay in a police jail during the week, rather than prison like others awaiting bail hearings. The magistrate said he agreed to that request from his defense team because they needed to prepare the case.

Some sponsors have also distanced themselves from South Africa's star athlete. Nike Inc. NKE -0.27% Nike Inc. Cl B U.S.: NYSE $78.32 -0.21 -0.27% March 14, 2014 4:01 pm Volume (Delayed 15m) : 3.02M AFTER HOURS $78.20 -0.12 -0.15% March 14, 2014 7:27 pm Volume (Delayed 15m): 22,464 P/E Ratio 24.49 Market Cap $69.54 Billion Dividend Yield 1.23% Rev. per Employee $547,062 03/12/14 With Digital Fitness Trackers,... 03/03/14 Pistorius Neighbor: 'Bloodcurd... 02/18/14 Captain Corporate: Jeter After... More quote details and news » and sunglasses maker Oakley both suspended contracts with Mr. Pistorius.

Under other terms of his bail, Mr. Pistorius must pay twice-weekly visits to a police station in Pretoria. He is also prohibited from visiting his home in Silver Lakes, on the eastern side of the capital, or speaking with residents there.

Mr. Pistorius's coach, Ampie Louw, told reporters earlier in the day that if Mr. Pistorius was granted bail he would resume his training, but not compete.

Meanwhile, friends of Ms. Steenkamp sat in the courtroom teary-eyed. "We trust justice will prevail," said former housemate Kim Meyers.

—The Associated Press contributed to this article.

Write to Devon Maylie at devon.maylie@dowjones.com