What you need to know:
- Voters on the Tanzanian mainland and semi-autonomous archipelago of Zanzibar will cast their ballots for a president and lawmakers after an energetic campaign which saw massive turnout for both the ruling party and opposition.
- A series of tough media laws were passed, arrests of journalists, activists and opposition members soared and several opposition members were killed.
Tanzanians head to the polls on Wednesday in an election set to be a litmus test of President John Magufuli's authoritarian style after a five-year crackdown on the opposition and freedom of speech.
Voters on the Tanzanian mainland and semi-autonomous archipelago of Zanzibar will cast their ballots for a president and lawmakers after an energetic campaign which saw massive turnout for both the ruling party and opposition.
Magufuli's main challenger among 15 presidential candidates is Tundu Lissu, 52, of the Chadema opposition party, who returned to the country in July after three years abroad recovering from 16 bullet wounds sustained in what he believes was a politically-motivated assassination attempt.
Lissu's return has re-invigorated an opposition in the doldrums after a ban on political rallies outside of election time, multiple arrests, attacks, and what rights groups have slammed as the squeezing of democracy.
In a boost for the opposition's chances, Zitto Kabwe, the head of the popular ACT-Wazalendo party, this month endorsed Lissu for the presidency on the mainland, saying he "stands the best chance of beating President Magufuli in the presidential election."
In return, Chadema is backing veteran opposition candidate Seif Sharif Hamad in his sixth bid for the presidency in Zanzibar, this time against the ruling Chama Cha Mapinduzi (CCM) candidate Hussein Ali Hassan Mwinyi.
Zanzibar has a history of tense elections and violence but the campaign has been largely peaceful this year.
The archipelago, where 566,000 registered voters will take part in the polls, wrapped up its election campaigns on Sunday with colourful mass rallies.
On the mainland just over 29 million registered voters will cast their ballots from 7 am (0400 GMT) until 4pm (0100 GMT).
Opinion polls are banned so it is unclear who is the frontrunner, and concerns are high over incidents that could mar the vote.
"To my dismay, I have seen and heard reports of government and security representatives disrupting and preventing candidates' ability to campaign freely," US Ambassador Donald Wright wrote in a statement.
"As we get closer to election day, the pace and severity of these disruptions is quickening and deepening."
Tanzania has long been seen as a haven of stability in an otherwise volatile neighbourhood, but alarm has grown over a slide into autocracy since Magufuli's election in 2015.
Magufuli, 60, at first made wildly popular moves such as curbing foreign travel for government officials or showing up in person to make sure civil servants were doing their work.
Then, he banned political rallies and became increasingly intolerant of dissent.
A series of tough media laws were passed, arrests of journalists, activists and opposition members soared and several opposition members were killed.
Magufuli touts his expansion of free education, rural electrification and infrastructure projects such as railways, a hydropower dam set to double electricity output and the revival of the national airline.
"I will surprise you with more development projects if I win. What I did in the last five years is just peanuts," he said at one of his rallies, which have drawn large crowds.
Magufuli's government also passed a raft of laws to increase Tanzania's stake in its mineral resources and demanded millions of dollars in back taxes from foreign mining companies.
However analysts say Magufuli's hostile approach has alarmed investors.
And while the economy under Magufuli continued to grow at an impressive pre-coronavirus average of six percent, job creation has been "very little" and aggressive tax collection has hurt the private sector and made doing business harder, said Thabit Jacob, a Tanzanian political analyst based in Denmark.
The International Monetary Fund expects growth to fall to 1.9 percent this year.
The election campaign has taken place with little regard to the coronavirus pandemic. Tanzania stopped giving out official data on infection numbers in April, and Magufuli has declared the country Covid-free, which he attributes to the power of prayer.
The opposition and analysts have expressed serious concerns over how fair the election will be, pointing to the polls body which is made up of commissioners personally appointed by Magufuli.
"You don't expect the electoral commission to announce an opposition victory, this will never happen," said Jacob.
Observers also point to constant efforts to frustrate the opposition's campaign, whether teargassing Lissu's supporters or suspending his rallies for seven days after he raised fears about election fraud.
"There has not been one large event that has really thrown the free and fair moniker off of this election, it has been more a series of small things, death by a thousand cuts if you will," a western diplomat told AFP on condition of anonymity.