In this work, we investigate the optoelectronic properties of zinc oxide (ZnO) nanowires, which are good candidates for applications based on integrated optics. Single ZnO nanowire photodetectors were fabricated with ohmic contacts. By taking current transient measurements in different atmospheres (oxygen, air, vacuum and argon), and at various temperatures, we point out the importance of surface effects on the electrical behaviour. Results confirm that oxygen chemisorption is responsible for the existence of a high photoconductive gain in these devices, and for the first time a two step process in the photocurrent rise transient is reported. A maximum gain of G = 7.8 × 10 7 is achieved. However, under certain conditions, the persistence of the photocurrent can last up to several hours and as such may prevent the device from operating at useful rates. From a knowledge of the photocurrent response mechanisms, we establish a method to restore the photodetector to its initial state, with very low dark current, by applying an appropriate gate voltage sequence. This advances the state of the art for these detectors towards commercial applications. arXiv:1907.11393v1 [physics.optics]