Section 524 of the Canada Elections Act:
524. (1) Any elector who was eligible to vote in an electoral district, and any candidate in an electoral district, may, by application to a competent court, contest the election in that electoral district on the grounds that
(a) under section 65 the elected candidate was not eligible to be a candidate; or
(b) there were irregularities, fraud or corrupt or illegal practices that affected the result of the election.