More than a million criminal cases go through the courts every year, so you expect the odd miscarriage of justice. But the case of Stanislaw Skupian still makes my blood boil. His “crime”, as I suppose we have to call it, was to join the 41,000 entrants in this year’s London Marathon without the correct paperwork.

After another runner lost his number a few hundred metres from the finish line, Skupian seems to have picked it up on the spur of the moment and decided to join the sweating hordes. Although it was such a hot day that more than 70 competitors ended up in hospital, magistrates were told the run was a “dream come true” for Skupian, who was homeless, separated from his wife, and had reportedly had a mental breakdown. They preferred to see it as “fraud by false representation” and sentenced him to 13 weeks in jail.

“At the time he hadn’t fully appreciated that he was doing anything wrong,” Skupian’s defence lawyer had told them. “He dedicated the completion of it to his son and to homeless people, to inspire them that good things can happen to those less fortunate.”

London Marathon’s supreme jobsworth was just as unmoved as the Uxbridge magistrates. “It is good to see that justice has been done,” chief executive Nick Bitel said, having previously claimed that Skupian’s actions could damage his event’s reputation. This rather sad figure (Skupian, that is) was also sentenced to three weeks for theft, after being arrested at Heathrow airport with someone else’s ID and diary. The court was told he saw the airport as his temporary home.

It is hard to know who is more despicable – the magistrates who decided a homeless man should spend three months behind bars because he went for a run, or the comfortably off executive who gave them a standing ovation. As Ian Hislop almost said: if that’s justice, I’m a sweaty man running 26.2 miles while dressed as a banana. Skupian’s “fraud” hurt no one.

The man whose number he found, Jake Halliday, still raised tens of thousands of pounds for the blood cancer charity Bloodwise. Although he wasn’t able to finish, that was not down to Skupian but to the race stewards, who noticed he was running without his number – which he would probably never have found again, even if Skupian had left it where it fell. The marathon still raised tens of millions for the likes of Breast Cancer Now and the Epilepsy Society. Thirty-four world records were still set, including the fastest marathons dressed as tree, as a love heart, and as a poo emoji.

Stanislaw Skupian Photograph: Metropolitan Police/PA

As for the event’s sponsors, including Virgin Money, Lucozade Sport, Audible, Fuller’s London Pride and Renault, the only people bringing them into disrepute are Bitel and the Uxbridge magistrates. It’s just a shedload of people repeatedly putting one foot in front of another, for Christ’s sake. Get over yourselves.

Would I feel any different if I had been one of the runners on 22 April and learned that Skupian had “cheated” his way to a finisher’s medal and goodie bag (I wouldn’t put it like that, though others have)? I don’t think so. I have completed a marathon – very, very slowly, and with too much walking – and after all those hours in the rain all I was interested in was dragging myself over that final line. I wouldn’t have cared less if a bunch of couch potatoes had literally parachuted themselves into the final stretch, as long as they didn’t trip me up. And with the number of homeless people growing by the day, I certainly would not have begrudged one of them joining in for a few minutes’ fun.

As for deciding the poor sod belonged in jail, or applauding the people who put him there … Seriously? Who breaks a butterfly upon a wheel? An absolute tosser, that’s who.

• Phil Daoust is a regular Guardian contributor