A prisoner's skull was fractured as he was hit with a riot shield by a prison guard, a court has heard.
Michael Hastie-Davies, 25, suffered a bleed to the brain at HMP Parc in Bridgend county on 7 August, 2016.
David Potts, 25, of Coity, denies grievous bodily harm (GBH) with intent and GBH at Newport Crown Court.
Another officer, Nathan White, 28, of Maesteg, denies assault occasioning actual bodily harm and common assault against another prisoner, Ryan Madden.
Mr Potts is accused of injuring Hastie-Davies while Mr White allegedly attacked Madden.
The jury was told the officers assaulted the inmates with their shields while they were lying on the floor of an exercise yard during an effort to get them back to their cells.
Ruth Smith, prosecuting, said Hastie-Davies, Madden and another inmate were allowed into the yard and were accompanied by a prison officer, who was called away when another prisoner started a fire in his cell.
Ms Smith said: "The prisoners were asked to come in. At that stage they had not had their full yard allowance... they said they did not want to come in because their full yard had not finished."
The court heard the men stayed in the yard for about an hour and could be seen on CCTV knocking on the windows and asking to come back in.
"The prison service however decided that they had refused and would have to be forcibly removed from the yard," said Ms Smith.
Nine officers in protective clothing were sent, but Ms Smith said the prisoners laid down to show they were not a threat.
She said the alleged assaults took place within seconds and the prisoners were returned to their cells where Hastie-Davies complained he was losing his hearing and having problems with his balance.
The court heard he later spent four days in hospital with a fractured skull.
Both Mr Potts and Mr White told police they feared the prisoners might be armed.
Ms Smith said: "Both said they had been given instructions that if the prisoners did not move, they could use force for the protection of others and to get them off the yard.
"Mr Potts said he had shouted at the prisoners to get up and they did not respond."
Jurors were told Mr Potts did not dispute striking Hastie-Davies but the case centres on whether the force used by the accused was reasonable and lawful.
The trial continues.