In close elections, a sufficiently high share of invalid ballots - if driven by voter mistakes or electoral fraud - can jeopardize the electoral outcome. We study how the closeness of electoral race relates to the share of invalid ballots, under the traditional paper-ballot hand-counted voting technology. Using a large micro-level data set from the Italian parliamentary elections in 1994-2001, we find a strong robust negative relationship between the margin of victory of the leading candidate over the nearest rival and the share of invalid ballots. We argue that this relationship is not driven by voter mistakes, protest, or electoral fraud. The explanation that garners most support is that of rational allocation of effort by election officers and party representatives, with higher rates of detection of invalid ballots in close elections.