Cardiff Prison is safer than it was three years ago and is 'bucking the national trend' of rising violence, an inspection has found.
A report on HMP Cardiff, a largely Victorian building holding nearly 740 men, said the latest inspection in 2019 was "enormously encouraging".
The prison inspectorate said that compared to the last visit in 2016, the prison had made progress and improved in all but one area.
The report released on Tuesday did find that mental health issues, a high number of self-harm incidents and the availability of drugs remained issues at the prison.
HM Chief Inspector of Prisons Peter Clarke said: “HMP Cardiff disproves the clichés about inner-city Victorian prisons inevitably being places of squalor, violence and despair. The improvements since the last inspection were incredibly encouraging to see, and were testimony to the hard work that had brought them about.”
Despite the wider improvements, the inspection which took place in July found the prison was "not immune to wider social problems".
HM Inspectorate of Prisons said: "Some 65% of arrivals reported having mental health problems.
"Over half of new prisoners reported drug problems and a third said they had problems with alcohol.
"In the six months prior to our inspection more than 350 prisoners required alcohol detoxification. Worryingly, since the last inspection levels of self-harm had risen threefold."
Homelessness on release was also a problem for the prison, which released more than 200 men a month.
During the six months before the inspection the report said "an extremely high figure" of 47% of the prisoners being released did not have any form of accommodation to go to.
The report added that the need for mental health support was "high" with 65% of prisoners reporting mental health problems on arrival, and that demand for services was "higher than we normally find".
Inspectors found that the level of self-harm was more than three times higher than at the previous inspection. Interviews with prisoners who self-harmed did help staff understand the causes of the problem, but the report said there was "no clear strategy" to reduce numbers.
The report said mental health services should also assess prisoner's needs more quickly, with too many prisoners waiting "too long" to access routine care and treatment.
Continued drug use in the prison was also found to be an issue, with the report describing it as "still a very real problem".
A survey of prisoners found that 52% found it "easy" to get illegal drugs at HMP Cardiff, the same as a comparative prison.
Inspectors said the prison would benefit from more technology and the lack of a body scanner was a "significant gap in their defences".
The report said there were still overcrowded cells in the prison, but for a local prison of its type and age progress had been made since the last inspection.
But in their more than 100 page report, inspectors said they were "not confident" complaints from prisoners were always answered.
It said: "We were particularly concerned that in one serious complaint alleging sexual assault, no formal action had been taken.
"The analysis of complaints was limited, making it difficult for the senior management team to identify the issues and action required. Prisoners were not routinely provided with support with legal issues or bail applications."
The HM Inspectorate of Prisons said in the 2016 inspection that outcomes for Cardiff prisoners were "not sufficiently good in the areas of safety and respect".

Mr Clarke said that by July 2019 the prison had made "real progress" with grades improving in all but one of HMI Prisons’ healthy prison tests, rising in safety, respect and purposeful activity.
The HM Inspectorate of Prisons added: “In view of the challenging context in which prisons, particularly local prisons, have been operating in recent years, this represents a very significant achievement.
“Importantly, the prison was relatively safe. Fewer prisoners than in similar establishments told us they felt unsafe, which is an enormously important indicator that affects so much else that happens in a jail. We often see the corrosive impact of violence on many aspects of prison life when the prisoners themselves are living in fear.
"It is much to Cardiff’s credit that while violence figures across the prison estate have generally been rising at an alarming rate in recent years, they had managed to buck the trend. Violence had not increased since the last inspection.”
HM Prison and Probation Service director general of Probation and Wales Amy Rees said: “This is a positive report and I am glad that the chief inspector has recognised the hard work of staff and the leadership team at HMP Cardiff.
"It has set a great example for similar, local prisons to follow. The prison is in a much better shape than just a few years ago - there are better relationships between staff and offenders, good work to intercept drugs and the introduction of the key worker scheme has helped to limit violence.
"The prison has now introduced a new strategy to reduce the number of prisoners self-harming and the Prison Service is working closely with the Welsh Government to address the issue of homelessness on release.”