HARARE, Zimbabwe (AP) — Zimbabwe's top court Friday upheld the narrow and disputed election victory by President Emmerson Mnangagwa, clearing the way for his inauguration as the country remained deeply divided in the post-Robert Mugabe era.

Mnangagwa, a former Mugabe enforcer who has tried to restyle himself as a reformer, will be sworn in on Sunday. He appealed for calm and told opposition challenger Nelson Chamisa "my door is open and my arms are outstretched."

The opposition, wary after a deadly military crackdown on protests after the election, initially said it would respect the ruling but later issued an angry statement rejecting the decision and saying it entrenched "an illegitimate regime."

Zimbabwe's electoral commission had declared Mnangagwa the winner of the July 30 balloting with 50.8 percent of the vote. It later revised it to 50.6 percent, citing an "error" but arguing it was not significant enough to invalidate the win. It said Chamisa received 44.3 percent.

The opposition alleged there was widespread vote-rigging, saying the electoral commission increased Mnangagwa's figures through double counts and the creation of "ghost" polling stations. In bringing its case to the Constitutional Court, it had sought a new vote or a declaration that Chamisa had won.

But in its unanimous ruling, which along with the lawyers' arguments in the case was broadcast live on state-run television, the court said the opposition failed to show "sufficient and credible evidence" to back up claims of irregularities. It said that the electoral commission had "debunked to some degree" those and other claims.

Security was tight in the capital, Harare, and streets remained calm. Some people celebrated outside the ruling ZANU-PF party headquarters.

"I know you feel cheated, but take heart," Chamisa told his supporters on Twitter, vowing that the opposition would "rescue our beautiful Zimbabwe from the jaws of poverty, corruption & dishonesty."

Douglas Mwonzora, secretary-general of Chamisa's Movement for Democratic Change party, told reporters that "this is the end of the road" for legal challenges.

"But we have other avenues. ... We can demonstrate," he added.

In a statement issued hours after the decision, the MDC said that in the coming days the opposition will announce a "vigorous program of action in response to this electoral theft of the century."

"While we respect the court, we don't accept its manifestly unjust decision," the statement said.

"Specifically, we are going to show Mr. Mnangagwa and the world that the peaceful masses have rejected him," it added. "They will never accept him. Our constitution is our shield."

The 75-year-old Mnangagwa said the election was Zimbabwe's most transparent and credible ever.

The government badly wanted a credible election to help end its status as a global pariah and open the door to investment. Mnangagwa is seeking the lifting of international sanctions and the revival of an economy that collapsed under Mugabe's repressive 37-year rule.

The election itself was peaceful, but six people were killed when the military swept into the capital two days later to disperse protests. The violence led to fears that Mnangagwa's government was stuck in the past.

Dozens of Western observers invited into Zimbabwe for the first time in nearly two decades gave a mixed assessment. They noted that election day had few issues but they expressed concerns over the deadly violence and harassment of the opposition that followed.

Mnangagwa took power after Mugabe stepped down in November under military pressure. While the soldiers were welcomed with cheers, feelings cooled as the election approached and the opposition worried the military would pressure voters to ensure the ruling party would not lose its grip.

The European Union delegation on Friday urged all parties to call for "calm and restraint in both victory and defeat."

Opposition figure Tendai Biti, who drew global concern about a crackdown after he was denied asylum in Zambia and charged at home with inciting violence, said that "we will take body blows but we will continue our fight for truth and justice."

Meanwhile, the ruling party began preparing the national stadium for Sunday's inauguration of Mnangagwa.

"We are ecstatic that the court has upheld the will of the people," said Paul Mangwana, spokesman for the president, "although this case has delayed our celebrations."

___

Follow Africa news at https://twitter.com/AP_Africa