Humza Yousaf’s intervention comes after senior prosecutor chides ‘unhelpful’ politicians calling for law not to be enforced