PRETORIA, South Africa — What began Wednesday as a day for the prosecution to solidify what it had described as an irrefutable case of premeditated murder against Oscar Pistorius, the Paralympic champion, turned into a near-rout by the defense.

It was the second full day of a hearing to decide whether Pistorius, the double amputee who made Olympic history by running with able-bodied athletes in the 2012 Games in London, should be given bail as he awaits trial for shooting his girlfriend, Reeva Steenkamp. Pistorius claimed in an affidavit that he had mistaken Steenkamp for a burglar and had shot her out of fear.

But what was supposed to be merely a bail hearing took on the proportions of a full-blown trial, with sharp questions from the presiding magistrate, Desmond Nair, and a withering cross-examination that left the prosecution's main witness, Detective Hilton Botha, grasping for answers that did not contradict his earlier testimony.

At first, Botha's testimony seemed to go well. He explained how preliminary ballistic evidence supported the prosecution's assertion that Pistorius had been wearing prosthetic legs when he shot at the bathroom door, behind which hid Steenkamp. Pistorius claimed in his affidavit that he had hobbled over from his bedroom on his stumps and felt extremely vulnerable to an intruder as a result.

But when questioned by Barry Roux, Pistorius' attorney, Botha was forced to acknowledge sloppy police work. He conceded that he could not rule out Pistorius' version of events based on the existing evidence.

Roux accused the prosecution of selectively taking "every piece of evidence" and trying "to extract the most possibly negative connotation and present it to the court."

As Botha described how bullets had pierced Steenkamp's skull and shattered her arm and hip bones, Pistorius sobbed with his head in his hands.

"A defenseless woman, unarmed, was gunned down," Botha said.

Using a schematic diagram of the bedroom, the prosecutor, Gerrie Nel, asked Botha to walk Nair through the crime scene. The detective explained that Steenkamp's slippers and overnight bag were on the left side of the bed, next to the sliding balcony door that Pistorius claimed he got up in the middle of the night to close.

He also said the holster of Pistorius' 9mm pistol was found under the left side of the bed, next to where Steenkamp would have been sleeping. That called into question Pistorius' statement that he thought Steenkamp was in bed when he heard what he feared was the sound of a burglar, the detective said.

"If the girl was on the bed, that is where the holster was found," Botha said.

Botha said investigators had found two boxes of testosterone along with syringes and needles in Pistorius' bedroom. Testosterone is a banned substance for most professional athletes and is known to increase aggression in people who take supplements of it.

Roux said the substance was not testosterone but an herbal supplement that is used by many athletes and is not banned by anti-doping agencies.

Asked whether the substance had been tested, Botha said tests had not yet been completed. "I didn't read the whole name" on the container, the detective admitted.

He said witnesses had told him that they heard shouting in the house and that the lights were on, contradicting Pistorius' statement that it had been too dark to see anything in the bedroom. Other witnesses spoke about hearing two or three gunshots, then a woman's scream, followed by more shots, Botha said.

One neighbor, he said, heard "two people talking loud at one another; it sounded like a fight," between 2 and 3 a.m. Under cross-examination, he acknowledged that the neighbor lived almost 2,000 feet from Pistorius' home in Pretoria and could have been out of earshot. Questioned later by the prosecutor, he revised the estimate to 1,000 feet.

Botha was forced to admit that the police forensics team had missed a shell casing that the defense attorneys later found in the toilet bowl and that he had entered the crime scene without covering his shoes because the police had run out of shoe covers.

He also described previous violent incidents involving Pistorius. The athlete had threatened to assault a man in an altercation about a woman at a racetrack, Botha said. He told another man that he would "break his legs," Botha testified.

But he also acknowledged that there were no signs that Steenkamp had defended herself against an assailant and that the police had no evidence that the couple's relationship was anything but loving.

Botha also testified that Pistorius had foreign bank accounts and a house in Italy, which made him a flight risk.

Nair seemed skeptical that Pistorius was a flight risk.

"Do you subjectively believe that he would take the option, being who he is, using prostheses to get around, familiar as he is, to flee South Africa if he were granted bail?" Nair asked Botha.

"Yes," he replied.

Roux denied that Pistorius had any active foreign accounts or a house in Italy.

The court was adjourned, and final arguments in the bail hearing are to be heard Thursday morning.