LONDON (Reuters) - Thousands of prison officers walked out on Tuesday in protest at rising levels of violence in jails, prompting the government to seek a court injunction to force them back to work.

Prison officers in England and Wales are banned by law from taking strike action but up to 10,000 stopped work over concerns about the health and safety of staff and inmates.

They began their 24-hour action at midnight and were only providing emergency cover during the walkout.

Earlier this month, the government unveiled plans to reform prisons and improve safety, something Justice Secretary Liz Truss told parliament on Tuesday was her "number one priority". She condemned the "illegal" walkout, saying the action was putting more people at risk.

The government later won an injunction at London's High Court over the action.

"We have been clear that we expect prison officers to return to work with immediate effect," a Ministry of Justice spokeswoman said.

Prisons Minister Sam Gyimah told Sky News they had made an "outstanding offer" to the Prison Officers' Association (POA) over pay, safety and staff retention and urged the union to return to negotiations.

There have been several incidents in jails this year including an alleged murder while earlier this month prisoners took over parts of Bedford prison in central England before police and extra prison officers were drafted in to restore control.

Last week, two prisoners escaped from a London jail after leaving mannequins in their beds to fool guards and using diamond-tipped cutting equipment to break out. They were later recaptured.

"The POA has consistently raised the volatile and dangerous state of prisons, as chronic staff shortages and impoverished regimes have resulted in staff no longer being safe, a lack of discipline and prisoners taking control of areas," the POA said in a statement.

Its action meant suspects in custody could not be brought to courts for ongoing cases, including Thomas Mair who went on trial on Monday for the alleged murder of opposition Labour Member of Parliament Jo Cox a week before June's European Union referendum.

(Reporting by Michael Holden; editing by Stephen Addison)