This article extends the theory of optimal patents to allow for costly imitation of patented innovations. With costly imitation, a rival's decision to imitate depends on the length of patent protection awarded to the patentee: the longer the patent life, the more likely it is that rivals will "invent around" the patented product. Extending patent life, therefore, may not provide the innovator with increased incentives to research or to patent the innovation. In this case, I find that optimal patent lives are sufficiently short to discourage imitation. With both patent length and breadth as instruments, the optimal policy consists of broad patents (no imitation allowed) with patent lives adjusted to achieve the desired reward. These results are in sharp contrast to recent results on the optimality of narrow, infinitely long patents.