During Pain's assault on the Leaf, Danzo and the Elders didn't want Pain to get the Nine Tails to protect the village from destruction. But, hiding what Pain wants makes him destroy the village! That is to say, Pain was looking for Naruto/the Nine Tails, but Danzo didn't want to recall him and killed the toad messenger. But, by denying Pain what he wanted, he allowed him to really destroy the village.
Why did Danzo do that?