Tanzanian President John Magufuli on Tuesday dissolved parliament to allow for elections in October, pledging a "free and fair" vote in a country where the opposition has decried a climate of fear and violence.

Magufuli, who took office in 2015 promising a crackdown on corruption but whose strongman leadership style has drawn criticism, urged all parties to "avoid insults and violence" while campaigning.

The constitution requires that the 393-seat legislature be dissolved ahead of the elections. The vote is due in October but the precise date has not yet been set.

"I want to assure everyone that the elections will be free and fair, for all political parties," Magufuli, who is expected to seek a second five-year term, said in an address to lawmakers.

The dissolution comes just days after Tanzanian opposition leader Freeman Mbowe, who has announced his intention to run against Magufuli, was allegedly beaten and hospitalised in what his Chadema party said was a "politically-motivated" attack.

The European Union mission in the country lashed the assault on Mbowe as an "attack against democracy" while the US and British embassies also expressed concern.

Tanzanian police have cast doubt on the allegations.

Chadema says attacks against the party and its supporters have risen sharply under Magufuli, whose administration has been accused of eroding democratic freedoms in a country once seen as a beacon of stability in East Africa.

Chadema's deputy chairman Tundu Lissu, who is also seeking to contest the presidency for the party, lives in exile in Belgium after being shot multiple times outside his home in 2017.

Chadema and other opposition parties including Alliance for Change and Transparency (ACT Wazalendo) have called for an independent monitor to oversee the elections, warning they will not be free otherwise.

President John Magufuli, centre, at ceremonies last December to mark Tanzania's 58th anniversary of independence
President John Magufuli, centre, at ceremonies last December to mark Tanzania's 58th anniversary of independence AFP / STRINGER

"The current setup of the electoral commission does not guarantee free polls, as it favours the ruling party. The chairman and some other officials are appointed by the president, who is the ruling party leader," said ACT Wazalendo chairman Seif Sharif Hamad.

The ruling party won more than 99 percent of seats in local elections last November which the opposition boycotted because of alleged violence and intimidation.

The October elections will also select the president, lawmakers and councillors of Zanzibar, a semi-autonomous archipelago in Tanzania.

Magufuli also announced Tuesday that schools would reopen across Tanzania on June 29, saying the threat of coronavirus had diminished across the country.

Universities already reopened on June 1, despite complaints from some students that they might be at risk of infection.

Tanzania is one of the few countries in Africa that has not taken extensive measures against the virus.

Magufuli has played down the seriousness of the pandemic, and the country stopped providing updated information about its cases in April.

In late May the government summoned the top official at the US embassy to object to an advisory that warned of "exponential growth" of COVID-19 cases.

The foreign ministry said the claim was "not true and could cause panic among Tanzanians and foreigners".

Over the weekend Tanzania resumed its national football league, which was suspended in March because of the virus.