Facebook has shut down accounts it says are linked to the Ugandan government, only days before elections for a new president and parliament.

The social media giant said a network connected with the ministry of information had been using fake and duplicate accounts to impersonate users and boost the popularity of posts.

In a BBC interview, the government accused Facebook of being biased. The run-up to the election has been marred by tension and violence.

After 35 years in power, President Yoweri Museveni, 76, is being strongly challenged by music star Bobi Wine, who is 38 and draws much of his support from young people.

Bobi Wine has been detained periodically, and dozens of opposition protesters have been killed.

Campaigning has been banned in the capital, Kampala, and several other districts. The opposition says this is because it is popular in those areas, but the government says the measure is due to Covid-19 restrictions.

“We found this network to be linked to the government Citizens Interaction Center at the Ministry of Information and Communications Technology in Uganda,” Facebook said in a statement.

“They used fake and duplicate accounts to manage pages, comment on other people’s content, impersonate users, re-share posts in groups to make them appear more popular than they were,” the statement continued.

But government spokesman Ofwono Opondo hit back in a BBC Facebook Live interview, accusing Facebook of failing to adhere to “natural justice” and echoing suggestions by other government figures that the social network is trying to influence the election outcome.

“We are not familiar with anybody who complains about these accounts,” he said. “The owners have not received any notice and no-one was asked to make any response to the allegations.”

Mr Opondo described Facebook as high-handed. “I think they are playing the usual games,” he added. “We know that they have a side in this election perhaps.”