Friends of Lansdowne Inc. v. Ottawa (City), 2012 ONCA 273 is a helpful source for the distinction between illegal (ultra vires) and unreasonable bylaws:
 Since municipalities are creatures of statute, their jurisdiction is limited to the powers provided by the legislature. Accordingly, a city does not have jurisdiction to pass a by-law that authorizes acts prohibited by its governing legislation. Since a city has no particular expertise in jurisdictional issues, a court will review the legality of a municipal by-law on the standard of correctness: see London (City) v. RSJ Holdings Inc., 2007 SCC 29,  2 S.C.R. 588, at para. 37. Section 273(1) of the Act gives the Superior Court the discretion to "quash a by-law … for illegality."
 Absent illegality, municipal by-laws are well insulated from judicial review. Section 272 of the Act prohibits a review of a by-law passed in good faith "in whole or in part by any court because of the unreasonableness or supposed unreasonableness of the by-law." Thus, a court cannot interfere with a by-law that is unreasonable, but a court may quash one that is illegal.
 Courts reviewing decisions made within jurisdiction must apply a deferential standard: see Nanaimo, at para. 35. As the application judge explained, provided they act with jurisdiction, municipalities are accountable to their constituents, and not to the courts.