The first national strike by prison officers in England and Wales has ended after their union agreed to fresh talks on Friday with the government over pay.
The walkout took the government by surprise
All 129 non-private prisons suffered disruption after the surprise walkout by about 20,000 staff at 0700 BST.
A High Court injunction was granted against the Prison Officers' Association (POA) but many members initially refused to go back to work.
The government had called the strike illegal and unjustified.
It denied it had failed to address concerns about pay and falling morale among prison staff.
The strike action came after the union pulled out of a no-strike agreement with government.
The POA said the government had failed to deliver on "promise after promise" and it decided to call the strike without prior warning to avoid attracting a court order.
POA general secretary Brian Caton said: "If they gave us back our rights and put us under the restrictions that every other trade union is under, then they would have had that notice.
"After a day of what we describe as somewhat traumatic times in the history of the union, we will lead our membership back to work and we will do that in an orderly fashion and that is regardless of any court injunction."
Justice Secretary Jack Straw said: "I am glad that the POA has issued this instruction to return to work."
A spokeswoman said Mr Straw had arranged to meet the union's leadership on Friday, before he knew about the strikes.
The announcement to end the strike came after officers in Bristol, Canterbury and Long Lartin had returned to work in the afternoon, but other POA members were indicating they would stay out for 24 hours.
During the day, prisoners were kept locked in their cells, senior managers took charge of duties such as distributing meals and visitors were turned away.
PRISON OFFICER SALARIES
Auxiliary staff: £13,318
Night patrol: £14,084
Entry officer min: £17,744
Prison officer: £27,530
Senior officer: £29.371
Principal officer: £31,913
Recommended top pay in posts as of April 2007. Source: Office for Manpower Economics
An independent pay review body for prisons has recommended that salaries rise to between £12,000 for auxiliary staff to almost £32,000 for principal officers - a 2.5% increase.
But the POA, which has 28,000 members, said its value is reduced to below inflation by being introduced in two stages.
Among the prisons affected were:
Liverpool, where 25-30 striking officers temporarily suspended their action to deal with three inmates who had climbed on to a roof
Birmingham prison where fire engines attended to deal with two minor blazes
Frankland high-security prison, County Durham, where a handful of striking officers volunteered to go back to work because of the danger posed by inmates
Wormwood Scrubs, Manchester, Cardiff, Dartmoor, Exeter and Wakefield, where POA officials claimed 745 inmates - including Soham killer Ian Huntley - were guarded by no more than 20 senior managers
Officers at Bristol prison began to return to duties in the afternoon
The Association of Chief Police Officers said police cells were used for about 900 inmates who could not return to their normal prison after court appearances and for those newly sentenced.
The prison population in England and Wales is close to capacity levels, with about 80,000 people currently held.
Granting the injunction High Court judge Mr Justice Ramsey, said there was an "overwhelming case" that a legally binding agreement had been broken.
The court was also told a prisoner had been found dead in a cell at the category-C Acklington prison in Northumberland but a lawyer for the Ministry of Justice said he was not linking the strike and the death.
Mr Justice Ramsey said any strike would have "particularly difficult consequences" for prisons already filled to capacity.
"Given the current position in the prisons, it is clear in my view that this is an appropriate case where the administration of the prison service as part of the administration of justice in the country requires the grant of the injunction," he said.
Shadow minister for justice Edward Garnier said the government had "mis-managed, both strategically and on a day-to-day basis the prison estate" and "wound-up" the POA.