The government has won a High Court injunction blocking industrial action by prison staff on Wednesday.
The move prevents the Prison Officers' Association from asking members in England and Wales to withdraw from "voluntary tasks".
The POA said withdrawal from voluntary roles was not industrial action or a breach of discipline.
But the government argued the POA plan broke the law banning prison officers from taking industrial action.
The tasks the POA planned to withdraw included suicide prevention, first aid, control and restraint, and hostage negotiation.
Reaching his decision, Mr Justice Leggatt said: "It seems to me that the evidence indicates the proposed action constitutes industrial action."
The details of the injunction are now being discussed.
The POA's plan follows a dispute over pay and pensions and surging levels of violence behind bars.
Last week, ministers said pay rises of up to £5,000 would be given to some officers at 31 prisons in London and south-east England with recruitment problems.
But the POA said the pay rise had "incensed" its members, many of whom would not benefit.
In November, thousands of prison officers staged a 24-hour strike because of health and safety concerns.
The High Court ordered the POA to suspend the protest and talks later took place with the government, focusing on pay and pensions.
The Ministry of Justice announced last month that the National Offender Management Service would be scrapped and replaced with a new prison and probation service aimed at cutting crime and reforming offenders.
Shadow justice secretary Richard Burgon said: "The Tories' complacent attitude to relations with prison staff suggests they are still not serious about resolving the crisis they have created in our prisons."