This paper offers an economic rationale for compulsory licensing of needed medicines in developing countries. The patent system is based on a trade-off between the "deadweight losses" caused by market power and the incentive to innovate created by increased profits from monopoly pricing during the period of the patent. However, markets for essential medicines under patent in developing countries with high income inequality are characterized by highly convex demand curves, producing large deadweight losses relative to potential profits when monopoly firms exercise profit-maximizing pricing strategies. As a result, these markets are systematically ill-suited to exclusive marketing rights, a problem which can be corrected through compulsory licensing. Open licenses that permit any qualified firm to supply the market on the same terms, such as may be available under licenses of right or essential facility legal standards, can be used to mitigate the negative effects of government-granted patents, thereby increasing overall social welfare.