A road worker has to pay a £190 court bill because he took a selfie in the wrong place.

All courts in England and Wales have notices in their corridors and waiting areas, warning that it is illegal to take photos inside the court building.

But when James Alexander Kyle, 32, attended his friend's trial last November, he took a selfie of himself and his mates on his mobile phone inside Courtroom Two of York Magistrates' Court while the court was in session, and posted it on Facebook.

York magistrates heard the photo also included at least one of the people involved in the trial and the magistrates' legal adviser.

Kyle was arrested, charged with two offences under the Criminal Justice Act 1925 and sent back to the courthouse where he appeared in the dock of the same courtroom where he had taken the photo.

Asked by the magistrates why he had committed the crime, he said: "There were a few of us (in court)," he said. "I just took a photograph of all of us. It's called a selfie."

The Bench asked him: "Have you seen the notices around the building, saying no photographs?"

He replied: "Yes I have."

It was not his first time in the dock - he has previous convictions.

Kyle, of Staniland Drive, Selby, pleaded guilty to taking a photograph in a criminal court and publishing a photograph taken in a criminal court.

Magistrates fined him £85, plus £85 prosecution costs, plus a statutory surcharge of £20 and warned him not to do it again. Geoff Ellis, prosecuting, said Kyle posted the selfie on Facebook within hours of taking it - and that quickly led to the authorities realising what had happened. Kyle, who said he works for a traffic management firm putting cones on roads to direct traffic, represented himself. He apologised for his actions. The photo is no longer on his Facebook wall.