BRUNSWICK — A Portland man convicted of gunning down a friend argued Wednesday to the Maine Supreme Court that the judge at his trial should not have told the jury that he wouldn’t answer questions about the murder weapon.

Daudoit Butsitsi is appealing his 38-year sentence for the fatal shooting of his friend, Serge Mulongo, in 2010. Butsitsi had testified that the two men had been close but that their relationship had soured, and that Mulongo had assaulted him a number of times.

During his trial, Butsitsi testified that he acquired a gun about 20 minutes before the shooting, and took it with him for protection when he went to their apartment to retrieve his belongings. The prosecution maintained that Butsitsi shot Mulongo out of revenge.

Butsitsi shot Mulongo in the apartment building multiple times, testifying that he saw a gun in Mulongo’s hand. No gun was found on Mulongo, but a glass pipe was in his left hand.

During the trial last year, Butsitsi testified that he obtained the gun from a friend but would not identify the friend.

His appeal focuses on whether he had to answer the prosecution’s question during his cross-examination because he was testifying about the gun, or whether he was protected from self-incrimination by the Fifth Amendment at the time.

Justice Andrew Horton, the trial judge, found Butsitsi in contempt for refusing to answer. Horton told jurors that there had been a discussion about the matter while the jury was out of the courtroom, and that he ordered Butsitsi to answer but that he refused to comply.

Butsitsi’s team argued Wednesday before the state Supreme Judicial Court that the judge’s comment could have affected the verdict. The state maintains the judge was well within his discretion.

The gun Butsitsi used was linked to the unsolved homicide of Darien Richardson, a Portland woman who was shot during a home invasion a month before Mulongo’s shooting. Richardson died weeks after being shot, from a blood clot caused by her injuries. The jury did not hear details of the Richardson case during Butsitsi’s trial.

Oral arguments before the supreme court on Wednesday were held at Brunswick High School. The visit was part of the high court’s annual trips to high schools around Maine.