Why did Stalin rather than Trotsky emerge as the leader of the Soviet Union by 1929?

Why did Stalin rather than Trotsky emerge as the leader of the Soviet Union by 1929? Trotsky was the most well-known replacement for Lenin as he was the only member who could rival Lenin in intellect and his writings on Marxist theory. Trotsky’s impressive revolutionary record saw him make an invaluable contribution to the rise of the Bolshevik party between 1917 to 1924, yet it was Stalin, a man called upon by Lenin in his testament to be sacked through his rude nature and lack of tolerance who succeeded Lenin in a long hard-fought battle for leadership of the Soviet Union. There are numerous factors which contributed to the recognition as Stalin as leader, including Trotsky’s weaknesses, Stalin’s tactical and ideological manoeuvring and his own skilful personal qualities. However I believe the most significant reason to Stalin’s emergence as leader was his control of key institutions the Communist Party which stripped his opponents of power and left him as the only candidate left undefeated. The most important reason as to why Stalin emerged as leader was because he held key positions within the three most significant institutions within the Russian government, the Politburo the main organ of power, Orgburo which made important decisions about organizational work in Russia and arguably most importantly General secretary which meant he was able to appoint his own supporters to key positions within the party congress who elected the central committee which in turn elected the Politburo. By controlling the membership within the party congress Stalin also had the power to expel pro-Trotsky supporters, and therefore establish a system which gained him huge amounts of support to outvote the other contenders. Trotsky, one of Stalin’s main rivals encompassed authority as Head of the Army and consequently had limited power within the party. Stalin’s control of appointments and the membership made him a useful ally; as other contenders wanted him on their side as he could deliver votes in the congresses many party members
