A total of 1290 cod (Gadus morhua L.), sampled between 1985 and 1999 from a spawning area in the Trondheimsfjord, Norway, were assayed for the nuclear-encoded locus PanI (pantophysin). The majority of samples were taken during the spawning season at two nearby sampling locations at depths of 100 and 60 m, respectively. Genetic analysis revealed significant effects of cohort, sex and sampling location on allele frequencies at PanI. The contribution of each of these three factors to the total among-sample diversity (FST) of 8.01% at PanI was estimated to be 3.78, 2.55 and 1.68%, respectively. Sign tests revealed a significant excess of heterozygotes at both sampling locations in females; a significant excess of heterozygotes in males was observed at one of the localities. Mutation, genetic drift and immigration do not appear to contribute significantly to the observed genetic heterogeneity at PanI, leaving natural selection as the main explanatory factor for the Hardy–Weinberg imbalance. The dynamics of the selection at PanI appear to be complex. Analysis of age, sex and cohort proved crucial to disentangle putative explanatory factors from their secondary effects.