Myanmar’s military has strengthened its role in the ruling party by the purge of once-influential reformer and presidential hopeful Shwe Mann, revealing the powerful role the armed forces still play in a country supposed to be solidifying democracy in November elections.

Mr. Shwe Mann and his allies were expelled from top positions in the Union Solidarity and Development Party in a tense party meeting, guarded by police and soldiers who surrounded its headquarters Wednesday night. He was replaced as chairman by his predecessor, President Thein Sein, who now is in a stronger position to retain the country’s top office after the elections. The new central committee includes several leaders closely aligned to the armed forces.

The military increasingly viewed Mr. Shwe Mann, himself a former general, with suspicion over his growing relationship with opposition leader Aung San Suu Kyi, whom the military had kept under house arrest for most of two decades before starting a transition to civilian rule in 2011. Mr. Shwe Mann had pushed for constitutional changes that would have reduced the military’s power in the legislature.

The ouster was the most clear display in years that the military still wants to steer the politics of this Southeast Asian country, even though the armed forces have given up some of the total economic and political power they wielded during nearly half a century of repressive and impoverishing rule. The military says that it must remain in politics to ensure stability.

Mr. Shwe Mann for now remains speaker for when parliament reopens next week, though parliament will go into recess shortly afterward for the Nov. 8 elections. Khin Maung Oo, Mr. Shwe Mann’s secretary, said on Mr. Shwe Mann’s behalf that he came to work Friday in a “normal condition.”