(1)No action lies against a justice of the peace in respect of what he does or omits to do—
(a)in the execution of his duty as a justice of the peace, and
(b)in relation to a matter within his jurisdiction.
(2)No action lies against a justices' clerk or an assistant clerk in respect of what he does or omits to do—
(a)in the execution of his duty as a justices' clerk or assistant clerk exercising, by virtue of an enactment, a function of a single justice of the peace, and
(b)in relation to a matter within his jurisdiction.