An action may be brought by the Attorney General in the name of the State, upon his own information or upon the complaint of a private party, against the party offending, in the following cases:
(1) When a person usurps, intrudes into, or unlawfully holds or exercises any public office, civil or military, or any franchise within this State, or any office in a corporation created by the authority of this State; or,
(2) When a public officer, civil or military, has done or suffered an act which, by law, makes a forfeiture of his office.
(3) When any person, natural or corporate, has or claims to have or hold any rights or franchises by reason of a grant or otherwise, in violation of the provisions of G.S. 146-39. (C.C.P., s. 366; Code, s. 607; Rev., s. 827; 1911, cc. 195, 201; C.S., s. 870; 1983, c. 768, s. 1.)