Sheriff Craig McSherry, 63, was dealing with a drugs case when ‘Sweet Child O’ Mine’ started blaring out.
As a uniformed court officer looked around to work out where the song was coming from, the sheriff fumbled and pulled his phone out his pocket.
He managed to turn the rock classic off a few seconds into the introduction, before the rest of the band kicked in.
Muted sniggers could be heard from the public benches as lawyers in the Dunfermline court exchanged smiles.
After silencing his phone, the sheriff looked up and said “sorry” before nodding to a lawyer to continue with proceedings.
Mobiles are banned in all Scotland’s courts while they are in session.
Signs are placed on all doors as people enter court warning them to switch them off.
Read more at Dailyrecord.co.uk