We propose that the effects of attentional top-down modulations observed in the visual cortex reflect the simple strategy of strengthening currently relevant pathways in a task-dependent manner. To exemplify this idea, we set up a network model of a visual area and simulate the learning of a context-dependent 'go/no-go'-task. The model learns top-down gain-modulations of sensory representations based on reinforcements received from the environment. We also discuss how this idea relates to alternative interpretations like optimal coding hypotheses.