An action shall lie against any justice of the peace or justices' clerk in respect of any act or omission of his—
(a)in the purported execution of his duty—
(i)as such a justice; or
(ii)as such a clerk exercising, by virtue of any statutory provision, any of the functions of a single justice; but
(b)with respect to a matter which is not within his jurisdiction,
if, but only if, it is proved that he acted in bad faith.