Tanzania's ruling party candidate, John Magufuli, was declared winner on Thursday of a presidential election, after the national electoral body dismissed opposition complaints about the process and a demand for a recount.
The election has been the most hotly contested race in the more than half a century of rule by the Chama Cha Mapinduzi Party, which fielded Magufuli, 56, a minister for public works.
The main opposition parties united for the first time in a coalition to back a single candidate, former prime minister Edward Lowassa, 62, who had defected from CCM in July when the party snubbed his bid to be their flagbearer.
Lowassa had questioned partial results as they were announced and had called for a recount of the presidential vote in a nation that has been one of Africa's most politically stable. He had sought to stop a final result declaration.
Adding to tensions, a vote for the president of the semi-autonomous Zanzibar archipelago, traditionally a hotbed of opposition to central government, was annulled on Wednesday by the local election commission there, citing violations.
The opposition on the island said it had won that vote and said the annulment was a ploy by CCM to avoid conceding defeat.
National Electoral Commission Chairman Damian Lubuva told a news conference that Magufuli secured 58 percent of the votes against 40 percent for Lowassa. The body dismissed complaints.
"Since John Pombe Magufuli of the CCM party got the highest number of votes ... I hereby officially declare that he has been elected as president," Lubuva said, adding that turnout was 67 percent of the 22.75 million registers voters.
Chadema, a leading party in the Ukawa coalition that backed Lowassa, rejected the results, alongside another smaller party, an electoral official said.
Lowassa and Magufuli have drawn big crowds at rallies. Both promised to create jobs, help the poor, crack down on corruption and make sure everyone feels the benefits from huge gas and other resources in the nation of 47 million people.
Two independent opinion polls before voting began had given Magufuli a lead. CCM also retained its parliamentary majority.
In Zanzibar, police arrested several youths who had blocked roads in protest after the local election was annulled.
Zanzibar police commissioner Hamdani Omar Makame did not give number for those arrested but said by telephone that the situation was calm, with police patrolling the streets.
The United States and Britain both said they were alarmed by the decision to scrap the Zanzibar vote.
Election observers from the European Union, African Union and other international groups issued a statement saying it was concerned by the Zanzibar decision after they had "affirmed the credibility of the voting process."