"Konohagakure's future will be forged by my own hands!" Danzo thought fervently. Just as he had previously told Koharu Utatane and Mitokado Homura, he would deploy Root's members at the appropriate time. It was not that he intended to stand by without acting while Konoha fell. After all, Danzo's ambition was to become Hokage!
That was right! Danzo's greatest ambition was to become Konoha's Hokage, to lead Konoha in standing forever at the pinnacle of the shinobi world, forever suppressing the other hidden villages and establishing Konoha's hegemony. But there was one prerequisite to this ambition: Danzo believed that he had to become Hokage himself! Only then could he take control of Konoha's power!
Therefore, the Third Hokage had to die! Only after he died could Danzo become Hokage.
In his early years, Danzo had once taken advantage of an occasion when the Third Hokage left the village to try to eliminate him completely. Unfortunately, it was discovered. In the end, the Third Hokage had shown mercy, forgiving Danzo for this crime and not pursuing his responsibility too harshly.
From then on, Danzo had kept a relatively low profile. He had even seemed to truly become Konoha's Root. But now that Sunagakure had joined forces with Otogakure to launch a surprise attack on Konoha, Danzo had bared his fangs once more. To him, this was a once-in-a-lifetime opportunity.
Thus, Danzo did not hesitate to betray Konoha and the Third Hokage in certain matters, joining hands with Orochimaru. Of course, in Danzo's view, this was not betraying the village. It was to better safeguard the village's interests. Danzo was waiting for the right moment—until the Third Hokage and Orochimaru had fought each other to mutual ruin, at which point he would send out Root's members.
For Danzo, the best possible outcome