We present a computational model of attentional capture in humans. The model distinguishes between automatic mechanisms that directly determine the focus of visual attention, and deliberate mental actions an individual can perform to influence these mechanisms. The automatic mechanisms select an object as the focus of attention and enhance its location and features, so that nearby or similar objects are likely to be selected in the future. The deliberate actions include engaging with a selected object to further enhance its features, and retrieving a previously selected object from memory. By performing these actions, the model is able to exert limited top-down control over capture, increasing the probability that task-relevant objects will be attended and irrelevant objects will be ignored. To evaluate the model, we conduct a simulation of a recent visual search study, demonstrating that the model can account for three established factors that are known to influence capture.