PLAINTIFF’S APPEAL FROM THE ORDER ALLOWING DEFENDANT BOSWELL’S MOTION TO DISMISS UNDER RULE 12(b)(6)
[1, 2] Plaintiff alleged that defendant Boswell was at all times mentioned in the complaint “a magistrate of the District Court, duly appointed, qualified and acting as such.” A magistrate is an officer of the district court, G.S. 7A-170, and in issuing a warrant a magistrate performs a judicial act. State v. Matthews, 270 N.C. 35, 153 S.E. 2d 791. “A judge of a court of this State is not subject to civil action for errors committed in the discharge of his official duties.” Fuquay Springs v. Rowland, 239 N.C. 299, 79 S.E. 2d 774. “This immunity applies even when the judge is accused of acting maliciously and corruptly, and ‘it is not for the protection or benefit of a malicious or corrupt judge, but for the benefit of the public, whose interest it is that the judges should be at liberty to exercise their functions with independence and without fear of consequences.’ ” Pierson v. Ray, 386 U.S. 547, 18 L.Ed. 2d 288, 87 S.Ct. 1213. Thus, plaintiff failed to state a claim upon which relief can be granted by *271reason of any act of the magistrate in issuing the warrants. Nor do plaintiff’s allegations that his rights under G.S. 15-46 were denied serve to strengthen his claim against the magistrate. That statute is directed primarily to the arresting officer, and the facts alleged in this case furnish no basis to support a claim against the magistrate. Defendant Boswell’s motion to dismiss was properly allowed.
PLAINTIFF’S APPEAL FROM THE ORDER ALLOWING DEFENDANT STOCKARD’S MOTION FOR SUMMARY JUDGMENT UNDER RULE 56
The affidavits filed in support and in opposition to the motion for summary judgment were in conflict as to whether Sheriff Stockard’s deputies offered plaintiff medical assistance at the jail. However, a question of fact which is immaterial does not preclude summary judgment, and in this case the question whether plaintiff was, or was not, offered medical assistance at the jail is immaterial. Plaintiff alleged no damages as result of any failure to provide him with medical assistance.
 Plaintiff did allege a claim for damages against the sheriff for false imprisonment. In this connection there was no genuine issue as to any material fact. As one of the duties of his office, Sheriff Stockard was the jailer of the Alamance County jail. As such, the duty was imposed upon him by statute, G.S. 162-41 (formerly codified as G.S. 153-190.1), “to receive, incarcerate and retain any prisoner brought to such county jail by any law-enforcement officer of such county or of any municipality in such county.” Plaintiff was brought to the jail as a prisoner by two police officers of the City of Graham, a municipality in Alamance County. When this occurred the sheriff’s duty was fixed by the statute. He had no discretion in the matter, but was under an affirmative duty “to receive, incarcerate and retain” the plaintiff until plaintiff should become entitled to be released in some manner provided by law. On the undisputed facts, this is all that the sheriff did in this case. No valid claim for relief may be maintained against him for complying with his statutory duty.
There being no genuine issue as to the material facts which establish that defendant Stockard and the surety on his official bond were entitled to judgment as a matter of law, their motion *272for summary judgment dismissing plaintiff’s action as to them was properly allowed.
The orders appealed from are
Chief Judge Brock and Judge Britt concur.