Kenyan Independent Electoral and Boundaries Commission officials receive ballot papers. (Khalil Senosi/AP)

KENYA’S FRAGILE political system has veered between breakthrough and breakdown over the past two months amid a hotly contested presidential election. Now the country itself appears in danger of a violent implosion. The government of Uhuru Kenyatta insists it will go ahead with a rerun of the presidential vote on Thursday even though the incumbent’s principal challenger has withdrawn and senior election officials have warned that the outcome will not be credible. That could lead to mass protests and bloodshed — not to mention a major setback for African democracy.

The election system appeared to have worked in August, when international observers, including former secretary of state John F. Kerry, praised a vote that appeared to give a decisive victory to Mr. Kenyatta over challenger Raila Odinga. But to the surprise of all sides, Kenya’s Supreme Court ruled on Sept. 1 that election officials had not observed proper procedures for tabulating and reporting the vote, and it annulled the election. That, too, could have strengthened Kenya’s institutions — if Mr. Kenyatta and Mr. Odinga had not both played a spoiling role.

Under pressure from Western governments, Mr. Kenyatta accepted the Supreme Court’s decision. But he then did everything possible to nullify it. His supporters in parliament pushed a new law making it harder for the court to invalidate elections. Meanwhile, his supporters on the electoral commission blocked proposals to reform procedures and remove officials involved in the previous irregularities.

Last week, one member of the electoral commission took refuge in New York, saying that she had received death threats and noting that the murder of a commission official shortly before the August vote had not been solved. The commission’s chairman then said that his attempts to correct the failures cited by the court had been blocked and that “under such conditions, it’s difficult to guarantee a free, fair and credible election.”

Mr. Odinga meanwhile announced his withdrawal from the second election and began calling for street rallies of his supporters. That’s a dangerous tactic, given Kenya’s history: In 2007, at least 1,500 people were killed when Mr. Odinga’s followers took to the streets following his defeat in an election marred by fraud. The result was constitutional changes meant to ensure fair elections and head off such conflict. Now those institutional protections are being demolished.

Polls as well as the August vote suggest that Mr. Kenyatta would defeat Mr. Odinga in a free and fair election. That makes the president’s insistence on going forward with the vote on Thursday, instead of delaying it and encouraging reforms by the election commission, self-defeating. At best a nominally reelected Mr. Kenyatta will be left with a weakened domestic mandate and a lack of international credibility. Mr. Odinga, for his part, has never appeared willing to accept defeat, fair or otherwise, without a fight. His tactics and the government’s harsh response risk a conflict that Kenya cannot afford.