
72 S.E.2d 416 (1952)
236 N.C. 147
COREY et al.
v.
HARDISON, Mayor, et al.
No. 100.
Supreme Court of North Carolina.
September 17, 1952.
*419 Peel & Peel, Williamston, for plaintiffs, appellants.
Robert H. Cowen, Williamston, Albion Dunn, Greenville, and J. L. Emanuel, Raleigh, for defendants, appellees.
ERVIN, Justice.
The appeal raises this solitary question: Did Judge Frizzelle err in adjudging the defendants not subject to punishment as for contempt?
The plaintiffs set the proceeding as for contempt in motion on the theory that the refusal of the defendants to surrender the public offices, records, and funds of the Town of Jamesville to Lilley, Blount, Coltrain, Davenport, Gurganus, and Hamilton runs counter to this portion of the statute codified as G.S. § 5-8, subd. 1:
"Every court of record has power to punish as for contempt * * * Any clerk, sheriff, register, solicitor, attorney, counselor, coroner, constable, referee, or any other person in any manner selected or appointed to perform any ministerial or judicial service, for any neglect or violation of duty or any misconduct by which the rights or remedies of any party in a cause or matter pending in such court may be defeated, impaired, delayed, or prejudiced".
An act or default is not punishable by a court of record as for contempt under this statutory provision unless these three essential elements concur:
1. The alleged contemnor must be a clerk, sheriff, register, solicitor, attorney, counselor, coroner, constable, referee, or *420 other person appointed or selected to perform a ministerial or judicial service.
2. He must be guilty of neglect or violation of duty, or of misconduct in the performance of such service.
3. His neglect or violation of duty or his misconduct in such respect must have a tendency to defeat, impair, delay, or prejudice the rights or remedies of a party to a cause or matter pending in the court.
The plaintiffs maintain that Judge Frizzelle erred in holding the defendants not subject to punishment as for contempt. They advance these arguments to sustain their position: That the consent judgment rendered by Judge Burgwyn at the November Term, 1951, of the Superior Court of Martin County and the primary and election held by Mrs. Mae Waters, Clyde Glass, and Wilmer Holliday thereunder imposed upon the defendants as incumbents of the offices of mayor and commissioners of the Town of Jamesville the judicial duty to adjudge Lilley, Blount, Coltrain, Davenport, Gurganus, and Hamilton to be their duly elected successors, and the ministerial duty to surrender to them as such the public offices, records, and funds of the municipality; that the defendants violated these duties; and that the violation of these duties by the defendants tended to defeat, impair, delay, or prejudice the rights or remedies of the plaintiffs as parties to this cause to have Lilley, Blount, Coltrain, Davenport, Gurganus, and Hamilton placed in possession of the public offices, records, and funds of the Town of Jamesville.
The position of the plaintiffs is untenable for the very simple reason that the consent judgment and all proceedings had thereunder are void, and imposed no duties whatever upon the defendants.
When it adopted Section 4 of Chapter 596 of the 1945 Session Laws, the legislature clearly contemplated that the general municipal election thereby authorized and required should be held on the first Tuesday in May in the odd numbered years, and at no other time; and when it enacted Chapter 232 of the 1951 Session Laws, the legislature plainly intended that the primary election thereby authorized and required should be held on the fourth Monday preceding the general municipal election, and at no other time.
These things being true, the primary held on Monday, January 14, 1952, and the election held on the first Tuesday in February, 1952, fall under the condemnation of the rule that where a statutory provision fixing the time for holding a public election is mandatory, a public election held at some other time is absolutely void. Rodwell v. Harrison, 132 N.C. 45, 43 S.E. 540; State ex rel. Davis v. Osborne, 14 Ariz. 185, 125 P. 884; Simpson v. Teftler, 176 Ark. 1093, 5 S.W.2d 350; Merwin v. Fussell, 93 Ark. 336, 124 S.W. 1021; Kimberlin v. State, 130 Ind. 120, 29 N.E. 773, 14 L.R.A. 858, 30 Am.St.Rep. 208; Gossard v. Vaught, 10 Kan. 162; Doores v. Varnon, 94 Ky. 507, 22 S.W. 852; State v. Webb, 49 Mo.App. 407; State ex rel. White v. Ruark, 34 Mo.App. 325; State ex rel. Sibbald v. Brickell, 59 N.J.L. 420, 36 A. 1032; People ex rel. Smith v. Schiellein, 95 N.Y. 124; Brewer v. Davis, 28 Tenn. 208, 49 Am.Dec. 706; Cartledge v. Wortham, 105 Tex. 585, 153 S.W. 297.
The validity of this conclusion is not diminished in any degree by the circumstance that the primary and election were held in obedience to the consent judgment. In the very nature of things, a court lacks jurisdiction to authorize or compel the holding of an invalid primary, or a void election. The parties to a cause cannot by consent invest a court with a power not conferred upon it by law. Dees v. Apple, 207 N.C. 763, 178 S.E. 557; Saunderson v. Saunderson, 195 N.C. 169, 141 S.E. 572. When a court has no authority to act, its acts are void, and may be treated as nullities anywhere, at any time, and for any purpose. High v. Pearce, 220 N.C. 266, 17 S.E.2d 108.
The order holding the defendants not subject to punishment as for contempt under G.S. § 5-8, subd. 1, is correct for the additional reason that the supposed right to have Lilley, Blount, Coltrain, Davenport, Gurganus, and Hamilton placed in possession of the public offices, records, and funds of the Town of Jamesville is *421 not a right or remedy available to the plaintiffs as parties to this cause. It is manifest that the court can not recognize or enforce this supposed right without first adjudging that the claims of Lilley and his associates to the offices of mayor and commissioners of Jamesville are superior to those of the defendants. This matter is not open to determination in this case. This is so because the title to a public office can only be determined in a direct proceeding brought for that purpose under the statutes incorporated in Article 41 of Chapter 1 of the General Statutes. State ex rel. Freeman v. Ponder, 234 N.C. 294, 67 S.E.2d 292.
There is no factual or legal basis for any suggestion that the election held on the first Tuesday in February, 1952, was conducted under the provisions of Section 14 of Chapter 596 of the 1945 Session Laws.
For the reasons given, the order of Judge Frizzelle is
Affirmed.
