* UK government takes over G4S-run prison
* Investigation found squalid conditions
* Move poses latest challenge to government (Adds details on G4S)
LONDON, Aug 20 (Reuters) - The British government has taken over the running of a major prison from contractor G4S after an inspection found that staff locked themselves in offices to avoid prisoners who were using drugs and violence with near impunity.
The Ministry of Justice said on Monday it had taken back control of the Victorian-era HMP Birmingham to counter "squalid" conditions where blood, urine, vomit and faeces were left to fester in cells and showers, attracting rats and cockroaches.
Inspectors of the prison, which holds 1,200 people, said they were physically affected by the stench of drugs in the atmosphere while their cars were set on fire during their visit.
The intervention poses yet another challenge to a government that is consumed by, and deeply divided over, its exit from the European Union. In the last year alone it has also had to take over the running of a major rail line and multiple construction projects when their private ownership failed.
Peter Clarke, a former counter-terrorism commander and now chief inspector of prisons for England and Wales, said he had never seen anything like it.
"Think of squalor, filth, the air hanging heavy with the smell of drugs, the dilapidated physical environment, a sense of great instability, the feeling that at any time violence could break out.
"Put all that together, and what you have is a sense of an establishment that could not possibly fulfil any of the objectives of imprisonment," he told BBC Radio.
The news is likely to revive the debate in Britain about whether private companies should be running essential public services after Carillion, a contractor and outsourcing group, went bust earlier this year, putting thousands of projects in jeopardy.
Britain began outsourcing public services in the late 1980s under Margaret Thatcher and the industry enjoyed a boom under Labour's Tony Blair and Gordon Brown. It is now the world's second-largest outsourcing market behind the United states.
The opposition Labour Party promised to renationalise mail, rail, energy and water services during last year's election.
Of 123 prisons across England and Wales, 17 are run by private companies, including five by G4S. The Ministry of Justice said that in general contracted prisons are among the best performing across the prison estate.
"HMP Birmingham was the first publicly-run prison to be transferred to the private sector," said Richard Burgon, the Labour Party's justice spokesman. "This should be a nail in the coffin for the flawed idea of prison privatisation."
G4S is the world's biggest security company, employing 570,000 people in more than 90 countries.
Providing security at airports, immigration centres and for the movement of cash, it has hit a number of problems over the years. It made the headlines in 2012 when it failed to recruit enough security guards for the London Olympics, forcing the army to step in at the last minute.
In 2016, the government had to take over the management of a youth offending centre in Kent from G4S and last year the company started an independent review into its Brook House immigration removal centre after a BBC programme showed staff behaviour which G4S called "unacceptable".
A deadly riot broke out at a G4S-run immigration centre on Manus Island in Papua New guinea in 2014, with one asylum seeker killed and more than 60 injured.
In Britain, the Chief Inspector of Prisons said HMP Birmingham in Britain's second biggest city had deteriorated dramatically in the last 18 months, with staff locking themselves in offices and prisoners openly using drugs.
"This is the only jail... where I personally was forced to leave a wing because of the effect the drugs were having on me. It was just ridiculous, frankly," Clarke said.
His report detailed one incident where a "clearly troubled man" who was struggling to maintain personal hygiene was drenched by prisoners who put a fire hose through his observation panel.
Inmates said they did not feel safe when in their cells. Testing suggested a third of prisoners were using illicit drugs while inspectors said drug use and trafficking was "blatant".
"What we have seen at Birmingham is unacceptable and it has become clear that drastic action is required to bring about the improvements we require," said Prisons Minister Rory Stewart.
The government said it would run the prison for an initial six months and put in place a new governor, more staff and move around 300 prisoners to other sites.
G4S said the prison faced "exceptional challenges". Its shares fell in early trading but were flat by 1030 BST.
In 2017 "care and justice" services, which it provides in Britain and Australia, accounted for about 7 percent of its annual 7 billion pounds ($8.9 billion) worth of revenue.
"The well-being and safety of prisoners and prison staff is our key priority and we welcome the six month step-in and the opportunity to work with the Ministry of Justice to urgently address the issues faced at the prison," it said.
($1 = 0.7841 pounds) (Editing by Toby Chopra and Adrian Croft)