Image copyright Dan Peterson Image caption All criminal cases start life in the magistrates' court

Most of us will hope never to set foot in one, but thousands end up appearing in court each year. What is it like in Wales' 14 magistrates courts - and how are they working? In the first in a series of pieces, we spend the day at three courts.

"You never know what's going to happen."

In the end, Crown Prosecutor Abul Hussain's day runs mainly as he'd planned at Swansea Magistrates' Court.

Twenty cases in five hours, involving: knife crime; a Spice habit formed in prison; football-related violence; plus allegations of domestic violence, historic sex offences and a trap set by paedophile hunters.

In fairness, he'd prepared for 10 more cases, but life in the magistrates' court, as he said, is unpredictable.

A day shadowing him in Swansea is an eye opener. Reporters are used to courts, usually dipping in for specific cases, but this is a glimpse of the workload of one key part of that bigger picture. And a role that rarely gets the media spotlight.

All criminal cases start life in the magistrates' court.

From driving under the influence of drink or drugs, to rape and murder. Some will stay here in the lower court - whether it's "the bench" of three magistrates, or a district judge, they have powers to give a maximum of six months in jail. Anyone being tried for a crime that attracts a longer sentence is sent to crown court for their case to be heard. But each will pass through "the mags".

Abul knows today will be one of the busier of his week. When we meet the day before, he talks through his prep - checking each case, anticipating questions from the magistrates and ensuring he has the answers.

His list comprises 18 morning cases where a guilty plea is anticipated, and a further 12 in the afternoon where not guilty pleas are expected. But all of that could change.

It starts with a string of drink-drive charges, with defendants who've declined legal advice. Courts are seeing an increasing number of "litigants in person" - who have either declined the free advice from a duty solicitor, or can't afford the costs of a private defence solicitor. And while that may be fine for the straight forward case, it inevitably adds time, as the process is explained to each of those who arrive looking bewildered, apprehensive, or tearful.

From the miscalculation about how much will put a petite 20-something over the limit, to a recent bereavement causing a lapse in judgement. Each loses their licence. Others know they'll also lose their job.

Because beneath each charge sheet is a life unravelling.

Take the man found in a night club with a knife. It's a tool from work he'd forgotten about - only discovered at 06:30 after 12 hours' drinking and gambling. The gravity of its presence only realised when he's arrested, along with the damage his addictions are having.

Or the driver over the limit - again - this time with his young son in the car. Probation reports reveal work-related PTSD has led him to drink. But as a serving police officer, it's the end of what had been a promising career.

Image copyright Dan Peterson Image caption The waiting room

There are those whose lives are lived through the courts. The 72nd appearance for a 35-year-old man who developed a Spice habit in prison. Or the 78 previous convictions for a 34-year-old who arrives - it appears - intoxicated. Conviction 79 is doing a runner without paying a £20 taxi fare - and stealing the dash-cam for good measure. Eyebrows are raised when it's revealed that two weeks on, he's still got the dash-cam and has brought it to court with him to be returned to its rightful owner.

Today's cases are before a district judge, and we're rattling through them. Most last less than 10 minutes. A list this long would take longer if being heard by magistrates - three people naturally need some time to reach a consensus.

Throughout, Abul is updating his files.

Dealing with hushed requests from defence solicitors, crouching at his side.

Or a whisper to the clerk to get a heads up on which case she'll call next. He admits these days are exhausting.

Image copyright Dan Peterston Image caption Swansea Magistrates' Court is one of 14 remaining in Wales

Since 2010, 22 magistrates' courts have closed in Wales, meaning all of the work is funnelled through the remaining 14. Efficiencies have been brought in to help keep costs down, investment has been made in new technology - the upshot is those remaining in court are multi-tasking, even while cases are heard.

So for those outside, yet to have their cases called, there will be hours of waiting. For those inside, processing the cases, it's non-stop.

At Merthyr Tydfil magistrates, there are defendants drawn from an area stretching north of Brecon to Pontypridd. One man is two hours late for his appearance because he walked 10 miles from the Rhymney valley to get here.

The bench - two women and a man - will hear 14 cases in Court 2. As well as taking advice from their clerks, they spend a good period of time retiring to weigh up each sentence.

The offences range from drunken behaviour after the Royal Welsh Show to sending a threatening text in a family row. Some are listed for trial or are serious enough to be sent to the crown court for sentence. There is a framework to follow but they want to hear the back-stories too.

One long-term Rhondda hospital patient, 29, admits threatening words and behaviour towards a patient and staff. She has a history of 17 assaults, some mental health issues, as well as physical health problems, and the bench wants a pre-sentence report from probation with "all options open".

A 28-year-old Tredegar man, stopped in his car in a routine police check on a remote country lane, had traces of amphetamine in his blood from the day before. Although not obviously impaired, the aggravating feature is that his partner was in the car at the time. He needs the car for shift work and now faces losing his job after the inevitable 12-month driving ban.

Image copyright Dan Peterson Image caption Defendant in dock at a magistrates' court

Alcohol plays its part in the next case from the Rhondda - a 38-year-old man, on pain killers for a bad knee, who has not touched drink for two years before he ends up drinking six or seven pints of lager during a family get-together.

He cannot remember jumping onto car bonnets and smashing windscreens with his fist. One car was being driven at the time.

He can't remember either "making repeated howling noises" or soiling himself and urinating inside the police van. It's "a complete aberration". The in-court probation officer is asked to consult with him - and he is back in the dock later to be given a 12-month community order, with 15 days community activity and a fine.

The saddest case is at the end of the day: a 35-year-old local man who admitted theft of toiletries from Poundland - the latest in a list of 74 similar offences - and possessing a small amount of Spice. It's not the only case involving Spice that day.

The shoplifting comes only a couple of weeks after his release from prison on licence, so he is in a real danger of being sent back inside.

His solicitor tells magistrates that Spice has been the man's "drug of choice" in prison over the last year. "He's found it easier to get Spice inside prison than on the outside and had been using £30 worth a day," the court hears.

He has since been trying to tackle his addiction and, after being homeless, was now staying with his sister.

He is sobbing in the dock as his solicitor pleads for him not to be sent back to prison. The magistrates say the probation service "see something in you" and decide to give him "a real opportunity" by giving him a suspended prison sentence and 40 hours unpaid work.

Image caption There were five Cardiff magistrates' courts sitting on our visit

At Cardiff Magistrates' Court, there are five courts in operation - Court 3 is the designated custody court in front of District Judge Neil Thomas.

It is the first since Saturday morning and there are 21 in police custody. The silence in court is punctuated by tapping on laptops from solicitors and probation officers, and the echo from the cells as each prisoner is escorted to the glass-walled dock.

The court deals with 18 cases. Eight involve people with a background in drug problems. There is also a Penarth businessman accused of assaulting his wife, breaching bail conditions by a phone call to her in the early hours, after connecting CCTV at the family home to a computer at his new address so he could monitor her movements.

Failure to comply with probation orders and after-prison supervision have also led to weekend arrests.

They include a 31-year-old woman from Barry. She has become a nuisance to emergency services, emailing the police contact centre 950 times in just over a year - including threats to harm or kill herself. These have included images of pills. Prosecutor Nia James says police have been required to take each threat seriously with "meaningless and fruitless searches", once involving the force helicopter and dogs.

Some emails are simply bizarre - reporting a cousin's dog with fleas or sending a photo of her dirty underwear. She is given a suspended sentence, rehabilitation activity - and a community behaviour order not to contact emergency services unless it's really genuine.

One 34-year-old Pentwyn man with a history of drug problems was shoplifting perfume at John Lewis to sell to buy food. He was already paying more in accumulated fines each month than he was receiving in Universal Credit. He is jailed for 18 weeks.

Another heroin addict, 41, with 39 previous convictions, stole jars of coffee from Tesco in Cardiff city centre in June. As there seems to be no issues since, he is given a suspended sentence.

A 30-year-old drug addict from Barry had failed to surrender to custody for offences which took place while at Cardiff Bay police station. These included smearing excrement inside three different police cells over a weekend - while trying to withdraw from drugs - and punching a police sergeant. He is jailed for six months.

Prosecution outcomes by offence Wales, 2017-18 Type of offence Number of convictions % success rate Against person 7,662 79 Motoring 5,729 87 Theft/handling 5,071 93.9 Drugs 3,007 95.3 Public order 2,686 88.1 Criminal damage 1,501 87.7 Burglary 778 86.3 Sexual 672 73.2 Fraud/forgery 472 88 Other 455 88.3 Robbery 154 73 Homicide 64 86.5 TOTAL 28,251 86.3

Back in Swansea, just as the morning list concludes - early - Court 3 here puts an offer out to its neighbours to take on cases and help them out. Abul smiles. He had warned on top of the 30 cases he'd prepared for, he might have to pick up more un-seen files.

The afternoon's session is predominantly for those who are pleading not guilty.

The grandfather accused of indecently assaulting a relative 20 years ago; the young man snared by paedophile hunters; and the Brentford fans in town for assaulting a police officer after Swansea's FA Cup win - all are given dates for their trials.

Which leaves the last case of the day, which no-one was expecting. Five days after she should have been in court, a young woman arrives, "tired and emotional" and clearly expecting to be given an immediate custodial sentence for her tardiness. Instead, she's told to return the next day when her case will be heard in full.

"Judge, you are a gentleman. I really wasn't expecting that."

Just as Abul said, you never know what's going to happen.