Much evidence supports a fundamental role for the subthalamic nucleus (STN) in rapidly stopping behavior when a stop signal or surprising event occurs, but the extent to which the STN may be involved in stopping cognitive processes is less clear. Here, we used an optogenetic approach to control STN activity in a delayed-match-to-position (DMTP) task where mice had to recall a response location after a delay. We first demonstrated that a surprising event impaired performance by both slowing the latency to respond and increasing the rate of errors. We next showed that these effects could be mimicked by brief optogenetic activation of the STN. Further, inhibiting STN during surprise blocked surprise-induced slowing, although without changing surprise-induced errors. These data are consistent with the hypothesis that STN is recruited by surprise to slow responding and that this can also interrupt cognitive processes. Under normal conditions STN-mediated stopping of behavior may slow or stop ongoing cognition to facilitate cognitive reorienting and adaptive responses to unexpected sensory information, but when malfunctioning, it could produce pathologies related to over-rigidity or increased distractibility