In clustered sensor networks, because CHs (cluster heads) collect data from sensors and transmit the aggregated data to the sink, it is very important to elect the CHs in a secure manner. In order to protect CH elections from attackers, unpredictability, non-manipulability, and agreement property should be guaranteed in CH elections. However, existing schemes for secure CH election cannot prevent intelligent attackers from violating the properties via cooperation. In this paper, we propose a scheme that securely elects CHs by detecting intelligent attackers and excluding them. For every CH election round, each CH candidate provides reputation values to other CH candidates according to their behavior and extracts real reputation values. Then, each node evaluates the real reputation values of members in its cluster and excludes some disreputable nodes from CH candidates. The scheme greatly enhances the non-manipulability and agreement property of CH election results compared to other rival schemes. Furthermore, the scheme presents higher non-manipulability and higher agreement property than other schemes, even in an environment where message losses can occur.