With uncertain scope of patent protection and incomplete enforcement, the effective strength of patent protection is determined by the legal system. We analyze how the legal system effects the incentives of firms to innovate, taking into account possibilities of strategic licensing and litigation to deter infringement. The legal regime that induces licensing provides incentives to exert R&D effort while preserving ex- post efficiency. However the ex-ante socially optimal patent-legal system depends on the technological opportunities available to the society. We also show that change from the American to English rule of legal cost allocation does not alter our results in a fundamental way.