Kenyan President Uhuru Kenyatta casts his vote in his home town of Gatundu, Kenya, on Oct. 26, 2017. (Ben Curtis/AP)

President Uhuru ­Kenyatta has won reelection in Kenya’s rerun vote, the country’s election commission announced Monday, after his opponent boycotted last week’s poll, claiming it was not credible.

Kenyatta’s victory was not a surprise — he won with more than 98 percent of the vote. But the tumultuous election season that has dragged on for months has left this country — East Africa’s most robust economy and a key U.S. ally — in a political crisis.

Kenyatta’s win will almost certainly be contested in court. If it is affirmed, he will confront a stark political divide, largely along tribal lines. Aside from the country’s major geopolitical challenges — notably an Islamist insurgency in neighboring Somalia that frequently stages attacks on Kenyan soil — Kenyatta will have to find a way to govern many citizens who do not see him as a legitimate president.

“Now we can begin the process of reimagining our nationhood,” Kenyatta said in his acceptance speech.

But he suggested that he would not pursue reconciliation talks with opposition leader Raila Odinga until any legal challenges to his victory were resolved.

“I’m not going to jump the gun,” he said.

Authorities said that only about 39 percent of registered voters cast ballots Thursday, in stark contrast to the original vote in August, when 80 percent participated.

In opposition strongholds, groups have protested since Thursday’s poll, and police in some cases have responded with lethal force. At least six people have been killed across the country. Odinga has accused the government of “genocidal pogroms.” Immediately after Kenyatta’s victory was announced, fresh demonstrations began in Kibera, Kenya’s largest slum, and dozens of police surged into the area.

Amnesty International on Monday censured the security forces’ attempt to intimidate and punish members of the opposition, particularly in the western city of Kisumu, an Odinga stronghold.

“In Kisumu, the evidence we gathered paints a grim picture of police shooting, aggressively assaulting, and even breaking into the homes of people suspected to be protesters,” the human rights group said.

But on Monday afternoon, the country’s electoral commission said it was ready to declare a winner and end Kenya’s most chaotic period since 2007, when more than 1,000 people were killed in post-election violence. Western officials have raised concerns that this fraught election might undo some of the democratic progress made over the past decade.

“We are transiting . . . legally uncharted waters,” said Wafula Chebukati, chairman of the Independent Electoral and Boundaries Commission (IEBC).

The rerun election was scheduled after the Supreme Court annulled the original August balloting, in which Kenyatta won with 54 percent of the vote to Odinga’s 44 percent. The court cited voting irregularities and unanswered questions about the electoral commission’s role, casting doubt over the results.

That decision was praised across the world as proof of Kenya’s judicial independence, but it ushered in a period of immense uncertainty, with the economy slowing dramatically and a crisis of confidence unfolding among the country’s election officials.

Odinga said this month that he was withdrawing from the rerun poll because he believed the electoral commission was still biased against him. He said he was turning his party into a “resistance movement.” Odinga’s critics, and some Western officials, said Odinga might have withdrawn because he had run out of money to finance his campaign.

On Monday, Odinga said he wanted the electoral commission to “carry out a credible election in 90 days,” an outcome that would seem to depend on another intervention by the Supreme Court.

One issue likely to be raised in any new court case against the rerun vote is that election officials were unable to open 3,635 polling stations out of about 41,000. Those stations remained closed because of opposition protests in western Kenya, which were seen as a threat to election officials.