Watson does not think that being locked up by the king is the best time for Holmes to practise sleight of hand, but Holmes has a plan and tricks the guard into approaching to see a trick
Holmes and Watson knock him out and lock him in the cell, and make their escape
I like the character consistency that Holmes has practised sleight of hand before







