Under section 172(1) of the Constitution, a declaration of invalidity under subsection (a) is mandatory once inconsistency with the Constitution is found, but the remedy of setting aside under subsection (b) is a separate, discretionary remedy that must be just and equitable. A court may decline to set aside an invalid administrative decision where the irregularity is a bona fide formal mistake, there is no malfeasance, and setting aside would cause disproportionate prejudice to innocent parties, with the declaration of invalidity itself serving as sufficient vindication of the principle of legality.