Stolen keys were used to free 500 prisoners from cells during a riot at HMP Birmingham, a court has heard.
Staff were sprayed with fire hoses during the 15-hour disturbance in December and forced to evacuate areas of the jail as they “lost control” of four wings.
Four inmates are on trial accused of taking part in a prison mutiny.
Pictures of prisoners in riot gear were posted on social media during the disorder, prosecutors said.
Prosecutor Simon Davis told a jury at Birmingham Crown Court that events started early on the morning of 16 December after doors to some cells were opened by prison officers.
“A number of prisoners climbed on to the suicide netting on one of the prison wings,” he said.
“Keys to key doors and gates were stolen from a prison officer – the cells of maybe upwards of 500 prisoners were opened by other prisoners.”
Staff evacuated some of the wings and large parts of the prison were subjected to criminal damage including graffiti, paint thrown against walls, looting of offices and damage to windows, doors, computer equipment and furniture. Some areas were also set on fire.
As officers tried to hold one particular gate, they were pelted with pool balls, paint and sprayed with fire hoses, the court heard.
Specially-trained Tornado Teams were brought in to restore order.
“There was a prison mutiny, you can take that as read,” Mr Davis told jurors.
“It will be up to you to decide whether these particular defendants were involved or not.”
On trial are John Burton, 39, Luke Mansell, 24, Carl Brookes, 33, and Ross Queen, 30. Mr Brookes and Mr Queen also deny a second count of failing to submit to lawful authority during the disorder.