Greg Anderson, the former trainer for US home run king Barry Bonds, appeared calm as a federal judge ordered him imprisoned for refusing to testify in the famed slugger's perjury trial.

Anderson, dressed in a dark suit with gelled and spiky hair, replied, 'Yes' when US District Judge Susan Illston asked if he understood that his refusal to testify would get him sent back to prison.

'It is causing us a lot of dislocation that you are not testifying,' Illston admonished Anderson. 'It is very important that you do so, so that the whole truth can come out in this trial.'

Bonds sat at a table with his lawyers, expressionless, as his childhood friend and long-time trainer was led out of the courtroom by a US marshal.

Anderson, among those convicted in the BALCO steroid scandal, has already served more than a year in federal prison for refusing to testify to a grand jury about Bonds and steroids.

The trial, in which Bonds is accused of lying to a 2003 grand jury by denying he knowingly used steroids, is scheduled to last about four weeks. It is expected that Anderson will remain in custody for the duration of the trial, and prosecutors could charge him with obstruction of justice after the trial.

Anderson's steadfast refusal to testify has been costly for the prosecution. Illston has thrown out a great deal of evidence, including private steroids tests and doping calendars the government said Anderson used to track Bonds' drug regimen.

Without Anderson testifying to corroborate the evidence, it was considered hearsay, Illston said, and inadmissible in a US court.

Before the bulky trainer was escorted out of court, lawyers squared off in opening statements.

Prosecutors sought to portray the former San Francisco Giants slugger as a steroids user who plotted to lie to the 2003 BALCO grand jury.

Defense attorneys said that Bonds told the truth and picked apart the government witness list, arguing the witnesses - including former employees and an ex-girlfriend - have vendettas against Bonds.

Assistant US Attorney Matthew Parrella spent nearly an hour detailing the history of the BALCO investigation in a matter-of-fact fashion, starting with the 2003 Internal Revenue Service raid on the steroids lab that kicked off the scandal.

Bonds planned to lie to the grand jury investigating BALCO, Parrella said, and met with Stan Conte, then-trainer for the Giants, in an attempt to 'get stories straight' before his testimony.

Parrella portrayed Bonds as extremely close with BALCO founder and confessed steroids dealers Victor Conte, calling Bonds a 'walking billboard' for the strip-mall steroids mill.

The attorney showed a promotional photo of Bonds with Conte and Anderson, the BALCO founder's hands resting on each man's shoulder, and called the trio the 'three musketeers of BALCO,' drawing an objection from the defense.

For the defense, attorney Allen Ruby maintained that Bonds was honest in the grand jury testimony that is at the heart of this case.

'He told the truth, he did his best and most significantly, he provided the grand jury with useful information,' Ruby said.

Ruby targeted several of the government's witnesses, describing them as vengeful and embittered toward the baseball star.

They have 'cooperated with the media in many of the poisonous things that have been out there about Barry. What they have tried to do is create a caricature: Barry Bonds, terrible guy.'