A prisoner swung a weightlifting bar "like a baseball bat" and struck a Polish inmate, a trial has heard.
Witness Janis Mihailovs identified 22-year-old Keith Porter to a jury as the attacker of a fellow prisoner in the gym at Aberdeen's Craiginches Prison.
Mr Porter denies attempting to murder Daniel Kaizer in a racially-aggravated assault in December.
Mr Mihailovs told the High Court in Inverness: "He swung it like a baseball bat and hit him on the head."
Three co-accused deny assaulting another Polish inmate, Lukasz Rusek, on the same date at the prison gym by repeatedly punching him on the head to his injury.
The Crown claims the alleged attack by George Stewart, Matthew Greig and Sean Laurenson was also racially-aggravated.
The trial continues.