MOSCOW — Bowing to pressure from international donors, the Ukrainian Parliament voted on Tuesday to remove a prosecutor general who had clung to power for months despite visible signs of corruption.

But in a be-careful-what-you-wish-for moment, veteran observers of Ukrainian politics said that the prosecutor, Viktor Shokin, had played an important role in balancing competing political interests, helping maintain stability during a treacherous era in the divided country’s history.

The United States and other Western nations had for months called for the ousting of Mr. Shokin, who was widely criticized for turning a blind eye to corrupt practices and for defending the interests of a venal and entrenched elite. He was one of several political figures in Kiev whom reformers and Western diplomats saw as a worrying indicator of a return to past corrupt practices, two years after a revolution that was supposed to put a stop to self-dealing by those in power.

As the problems festered, Kiev drew increasingly sharp criticism from Western diplomats and leaders. In a visit in December, Vice President Joseph R. Biden Jr. said corruption was eating Ukraine “like a cancer.” Christine Lagarde, the managing director of the International Monetary Fund, which props up Ukraine financially, said last month that progress was so slow in fighting corruption that “it’s hard to see how the I.M.F.-supported program can continue.”