PRETORIA, SOUTH AFRICA — South African police appointed a new chief investigator Thursday in the Oscar Pistorius murder case, replacing a veteran detective after unsettling revelations that the officer was charged with seven counts of attempted murder.

The sensational twist in the state’s troubled investigation fueled growing public fascination with the case against the double-amputee Olympian, who is charged with premeditated murder in the Valentine’s Day slaying of his girlfriend, Reeva Steenkamp.

During his bail hearing Thursday, Pistorius mostly kept his composure, in contrast to outbursts of weeping on previous days in court. Defense lawyer Barry Roux pounced on the apparent disarray in the state’s case, laying out arguments that amounted to a test run for the full trial yet to come.

Roux pointed to what he called the “poor quality” of the state’s investigation and raised the matter of intent, saying Pistorius and Steenkamp had a “loving relationship” and the athlete had no motive to plan her killing.

Pistorius, 26, said he mistook Steenkamp, 29, for an intruder when he shot her through a locked bathroom door in his home.

Prosecutors said the shooting happened after the couple got into an argument, and prosecutor Gerrie Nel painted a picture of a man he said was “willing and ready to fire and kill.”

Much of the drama Thursday, however, happened outside the courtroom as South African police scrambled to get their investigation on track.

The decision to put police Lt. Gen. Vinesh Moonoo in charge of the case came soon after word emerged that the initial chief investigator, Hilton Botha, is facing attempted-murder charges.

Seven counts of attempted murder were reinstated against Botha and two other police officers in connection with a 2011 shooting incident in which they allegedly fired shots at a minibus they were trying to stop.

Bulewa Makeke, spokeswoman for the National Prosecuting Authority, said the charges were reinstated because more evidence had been gathered.