In this paper, we consider a duopoly competing in quantity, where firms can invest in R&D to control their emissions. We distinguish between efforts carried out to acquire first-hand knowledge (inventive R&D) and efforts made to develop an absorptive capacity to be able to capture part of the knowledge developed by the rival. There are also free R&D spillovers between firms. We show that a regulator can reach the first best by using three regulatory instruments, which are a per-unit emissions tax, a per-unit inventive-research subsidy and a per-unit absorptive-research subsidy. The socially optimal R&D level for inventive research is higher than the one for absorptive capacity, even when the investment-cost parameters for inventive and absorptive research are equal and when there is both very little free spillover and a very high learning parameter. Interestingly, when the free spillover is high enough, the regulator gives a greater per-unit subsidy to inventive research, and when it is low enough and the marginal damage cost of pollution is sufficiently high, he supports absorptive research to strengthen R&D spillovers. Moreover, inventive research is actually taxed when the free spillover is low and the marginal damage cost of pollution is high.