G4S is to be permanently stripped of its contract to run Birmingham prison after the government was forced to take control of the failing jail.

The Ministry of Justice took the unprecedented step of seizing control of the prison last August, removing its governor and moving out hundreds of prisoners, hours before a severely critical report was published by the prisons inspectorate.

Ministers had hoped to restore management of the prison to G4S, which operates four other major prisons in the UK, but after extending the takeover in February to the end of summer, have decided to terminate the contract.

Violence, drugs and squalor: catalogue of problems at HMP Birmingham Read more

The prisons minister, Rory Stewart, said: “I am confident that HMP Birmingham has made good progress since the ‘step-in’ but to build on this, the prison needs stability and continuity. That is why we have mutually agreed with G4S that the public sector is better placed to drive the long-term improvements required and the contract will end.”

In August, the chief inspector of prisons, Peter Clarke, said there had been a “dramatic deterioration” since the last inspection in early 2017 and the government should launch an urgent inquiry into the state of the prison, the most violent in England and Wales and the site of riots in 2016.

The state of the category B prison reignited the debate over for-profit prisons debate and the involvement of the private sector in the running of jails.

Stewart said: “We need to be absolutely clear that we still believe in a mixed economy of providers with some of our private prisons among the best performing in the country. Indeed, G4S itself is running excellent prisons at Altcourse and Oakwood, and this government believes passionately that private providers should continue to play a crucial role in our system.”

Chris Grayling's worst failure? Not transport: the probation services | Cat Hobbs Read more

As part of the decision to bring HMP Birmingham back into the public sector, Her Majesty’s Prison and Probation Service (HMPPS) has agreed a settlement, with G4S paying £9.9m to cover the additional cost of the “step-in” action.

G4S staff at Birmingham will transfer to HMPPS contracts on 1 July and the governor, Paul Newton, who took command of the prison last August at the time of the takeover, will stay in the job.

Jerry Petherick, the custodial and detention services managing director of G4S, said: “HMP Birmingham is an inner-city remand prison which faces exceptional challenges including high levels of prisoner violence towards staff and fellow prisoners.

“We believe that it is in the best interests of staff and the company that management of this prison is transferred to HMPPS and we will work closely with the Ministry of Justice to ensure a smooth transition over the next three months.”