Tanzania’s new president, John Pombe Magufuli, holds up a ceremonial spear and shield during his inauguration on Nov. 5. (Khalfan Said/Associated Press)

ON OCT. 25, John Pombe Magufuli, a retired teacher, defeated opposition candidate Edward Lowassa in Tanzania’s most tightly contested presidential election in decades. Mr. Magufuli is a member of the party Chama Cha Mapinduzi, which has been in power for more than 50 years, but he ran on a campaign of change, promising to reduce corruption, make secondary school education free and tackle Tanzania’s energy problems. Mr. Magufuli won 58 percent of the vote to Mr. Lowassa’s 40 percent. Tanzanians also elected their first female vice president, Samia Suluhu Hassan . On the mainland, polling was largely peaceful. But the election was not without problems. Mr. Lowassa, a former prime minister, has refused to accept the results. Annulled voting in the semi-autonomous region of Zanzibar has raised fears of a political crisis.

Also worrying is the fact that a number of Tanzanians have experienced a chilling crackdown on online expression. According to reports, numbers of Tanzanians before and during the elections were detained under Tanzania’s harsh new cybercrime legislation, which then-President Jakaya Kikwete signed into law in May. The law contains draconian punishments for offenses such as sending unsolicited messages via text or other media. Under Section 16 of the cybercrime law, the publication of “information, data or facts presenting in a picture, texts, symbol or any other form in a computer system where such information, data or fact is false, deceptive, misleading or inaccurate” could be subject to at least six months in prison.

According to reports, at least three citizens were charged in October under the law, all accused of publishing false information or insulting information about public officials.

During the election, eight staff of the opposition party Chadema were reportedly arrested and charged under Section 16, with government officials accusing the group of publishing inaccurate and unverified data on Facebook, Twitter and the internal election management system. The Tanzanian Human Rights Defenders Coalition has said that police officers raided an office used by the Tanzanian Civil Society Consortium on Election Observation. Police arrested 36 clerks , accusing them of collecting and sharing election results. The organization said that it was collecting results from observers at polling stations.

These arrests confirm earlier fears and warnings that Tanzania’s ruling party is increasingly interested in stifling dissent and monitoring citizens’ activities online. This shift cannot be divorced from the trend of declining media freedoms overall in the country, despite its long-held image as a global leader in transparency and open governance.

If Mr. Magufuli is serious about tackling corruption and encouraging change in Tanzania, his government should prove it by eliminating harsh measures of the Cybercrime Act and the Statistics Act (which criminalizes publication of statistics that the government deems false or misleading) and reforming at least 17 other laws that clamp down on free speech and intimidate journalists. Instead he should work to create an environment that respects human rights and freedom of information.