The paper investigates the choice of a licensing mechanism by the holder of a patent whose validity may be challenged. Focusing first on weak patents, i.e. patents that have a high probability of being invalidated by a court if challenged, we show that the patent holder finds it optimal to use a per-unit royalty contract if the strategic effect of an increase in a potential licensees unit cost on the equilibrium industry profit is positive. The latter condition ensures the superiority of the per-unit royalty mechanism independently of whether the patent holder is an industry insider or outsider, and is shown to hold in a Cournot (resp. Bertrand) oligopoly with homogeneous (resp. differentiated) products under general assumptions on the dema...