We study the optimal extraction of a polluting nonrenewable resource within the following framework: environmental regulation is imposed in the form of a ceiling on the stock of pollution and a clean unlimited backstop technology can be developed by research and development. More specifically, the time taken to develop a new technology depends on the amount spent on R&D. A surprising result is that the stringency of the ceiling and the size of the initial stock of the polluting nonrenewable resource have a bearing on whether environmental regulation speeds up the optimal arrival date of this new technology. Compared to a scenario with no environmental externalities, stringent environmental regulation drives up the optimal R&D investment and brings forward the optimal backstop arrival date only in the case of a large initial resource stock. Otherwise, if the initial resource stock is small, regulation reduces optimal R&D and postpones the optimal backstop arrival date. These results are explained by the two roles played by the backstop technology. First, the backstop serves to replace oil once it has been exhausted. As extraction is slowed down by regulation, the exhaustion of the nonrenewable resource is postponed and the long-run gains of innovation are lowered. Second, environmental regulation raises the short-run gains of innovation by increasing the cost of consuming just oil.