Firstly it's not illegal.
Secondly I work part time and DS (aged 12) has to stay in the house on INSET days as I don't have enough holiday to cover those AND holiday. DH works away from home during the week.
I have a note that I leave out for DS on INSET days. It has a check list of what to do if he decides to go over to his friend's house (two streets away), like 'don't forget your key, take your wallet, send me a text NOW'.
I leave him sandwiches and drinks in the fridge, loads of snacks (he's a 12 year old boy, hollow legs...), tell the neighbours he's on INSET, he has my number, his friend's mum's number and a neighbours number.
He can go out to his friends, usually pre-arranged, but no one is allowed into the house. He doesn't answer the door bell.
I've also left a torch and a note of what to do in a power cut (leave fridge doors shut, put the radio on for company, send me a text in case it's localised).
He loves it - he plays on his PS4, watches TV, does some drawing or writes stories. He's usually got some homework to catch up on.
When I was 12 years old I was in charge of my siblings after school and during school holidays as my mum worked until 5pm. I don't think 5-6 hours on a few odd days hurts. As long as 4pm is the cut off time and the child is mature enough (and wants to do it - which is the important thing. If they think it's a great adventure then fine. If they're worried about anything then no.