Not stop a war, more like prevent a war and a possible great ninja warDon't be naive. Itachi had two options
1) Fight for the Uchiha clan and die with his family, including Sasuke
2) Stand on the Leaf's side, stop the War and save his brother
Itachi was torn between his clan and his village so even if he had joined the Uchiha he would've probably not fought seriously enough and would in the end lose. That loss would destroy the village and possibly make way for another great ninja war. Itachi had experienced these before and for the love of his village and his little brother and to not experience the grief, sadness and pain again he took it upon himself to take on the mission ti kill the Uchiha clan.