An inmate upset by a judge’s ruling grabbed a corrections officer’s gun inside a North Carolina courtroom Wednesday and shot him, then was killed as he struggled with other law enforcement officers.

Willie Forrest, a 37-year-old inmate already serving 56 years in prison for convictions on attempted murder and other crimes, was in court Wednesday to face a murder and other charges in the September 2002 home invasion and slaying of Garysburg, N.C., businessman John Hicks.