a, Experimental setup for behavioural experiments. Green region marks viral injection area; fibre-optic connector was attached to the light guide only transiently before testing. Cg, cingulate cortex; IL, infralimbic cortex; M2, secondary motor cortex; PL, prelimbic cortex. b, Confocal image from a mouse injected with CaMKIIα::SSFO–EYFP virus shows expression in prelimbic and infralimbic cortex. D, dorsal; L, lateral; M, medial; V, ventral. Contra, contralateral; Ipsi, ipsilateral. c, Representative images of prefrontal slices from PV::SSFO and CaMKIIα::SSFO mice stained for c-Fos 90 min after a 2 s 473 nm light pulse. Scale bar, 25 µm. Graph shows average c-Fos-positive cell counts in the mPFC of control, CaMKIIα::SSFO and PV::SSFO mice. d, Social exploration in control, CaMKIIα::SSFO and PV::SSFO mice of a juvenile intruder in the home cage. CaMKIIα::SSFO mice showed a significant reduction in social exploration. e, Mice administered one 2 s 473 nm pulse of light before fear conditioning were tested the next day for freezing in response to the conditioned context or auditory cue; CaMKIIα::SSFO mice were significantly impaired in freezing responses to both conditioned stimuli. On the following day, mice were reconditioned without optical stimulation and freezing was evaluated 24 h later. All mice showed similar freezing behaviour in the absence of light. f, Open-field exploration in CaMKIIα::SSFO (blue) and CaMKIIα::EYFP (grey) mice, before (Test 1) and after (Test 2) light activation. Example tracks from a CaMKIIα::SSFO mouse are shown. g, Novel object exploration over a 10 min period is similar in mice expressing CaMKIIα::SSFO (blue) and CaMKIIα::EYFP (grey). h, Phase contrast and fluorescence images of coronal sections from wild-type mice injected with CaMKIIα::SSFO in PFC (top) or V1 (bottom). i, Social behaviour in the three-chamber test is impaired following a 2 s 473 nm light pulse in mice expressing CaMKIIα::SSFO in the PFC (n = 5), but not in control mice (n = 6) or in mice expressing CaMKIIα::SSFO in V1 (n = 8). Time spent in a given chamber after stimulation is only significantly altered in mice expressing CaMKIIα::SSFO. All bar graphs depict mean ± s.e.m. (*P<0.05, **P < 0.005).