Section 1. Be it enacted, &c., That whenever a vacancy may occur in the office of constable in any borough, town, ward of any city, borough, or town or township in said Commonwealth by reason of failure to elect, failure to qualify, incompetency, death, resignation, removal, or for any other cause, it shall be the duty of the court of quarter sessions of the peace of the county in which such borough, city, ward, or township may lie, upon petition of not less than ten qualified electors residing in such borough, city, ward, or township to appoint a suitable person, who, upon being qualified as required by law, shall serve as the constable thereof for the unexpired term so vacant.