SANFORD, Fla. — Prosecutors in the second-degree murder trial of George Zimmerman scrambled Tuesday to undo damage to their case by one of their leading witnesses, a Sanford police officer who interviewed the defendant hours after he fatally shot Trayvon Martin.

The witness, Officer Chris Serino of the Sanford police, had testified under cross-examination on Monday afternoon that Mr. Zimmerman seemed to be telling the truth when he said he had fired his gun in self-defense. The officer’s remarks made for a dramatic moment in the trial — and clearly benefited the defense — but drew no immediate objection from the prosecutors. The court then recessed for the day.

But early on Tuesday, citing case law, the prosecution successfully argued that Officer Serino’s comments about Mr. Zimmerman’s truthfulness should be disregarded by the jury. The judge then instructed the jurors, who are being sequestered during the trial, to ignore the officer’s statement — nearly 17 hours after he made it.

Officer Serino’s testimony, in the second week of the trial in Seminole County Court, was the latest setback for prosecutors, whose witnesses have repeatedly helped bolster the defense’s case. Mr. Zimmerman has said he shot Mr. Martin, an unarmed 17-year-old, in self-defense after he was attacked on a drizzly night in February 2012. Prosecutors say that Mr. Zimmerman, who identifies as Hispanic, profiled Mr. Martin, who was black, and followed the teenager through the town house complex where Mr. Zimmerman lived and Mr. Martin, of Miami, was visiting.