A cyberattack claimed by the Anonymous hacking group took down dozens of government websites for a second day Saturday in Senegal amid simmering tensions nine months before a presidential election.

The @MysteriousTeamO account, claiming to belong to the hacker group Anonymous, said on social media that it had targeted websites run by the presidency and those using the domain of the government, including the defence ministry and the health ministry.

It also claimed to have affected the site of the national airline Air Senegal.

Most of the affected sites were back online by mid-afternoon on Saturday, but access to others remained intermittent.

Global internet monitor NetBlocks told AFP that the attack started at around midnight on Friday and had affected "dozens of government websites, networks, and online services".

"There do appear to be intermittent restorations in service, however these have not been sustained and the attack is ongoing," NetBlocks added.

The @MysteriousTeamO account said the attack was in "solidarity" with Senegalese citizens and their right to freely choose their president.

Government spokesman Abdou Karim Fofana acknowledged the attack, which he described as a distributed denial-of-service attack, designed to overwhelm the target with a flood of internet traffic, preventing the system from functioning normally.

The relevant department said its teams were working to return to normal "as soon as possible," he said in a statement.

Access to the website of the presidency and some other offices were restored on Saturday evening.

The attack comes amid a tense political climate in the West African country.

The opposition has denounced what it says is a growing crackdown by the government of President Macky Sall.

Uncertainty over whether he will run for a controversial third term, as well as the rape trial of opposition leader Ousmane Sonko, have fuelled tensions in the relatively stable nation.

Sonko has refused to appear in court, claiming the authorities are plotting to keep him out of the presidential race.

Having previously withdrawn to the south of the country during the trial, on Friday Sonko began a high-risk return to the capital Dakar, intending to draw out supporters along the way with a so-called "caravan of freedom".

Local media reported clashes between Sonko's supporters and security forces on Friday surrounding his arrival at Kolda in the south -- still a long way from Dakar.

Sonko's party said on Saturday that a 37-year-old father had died in the clashes, blaming the authorities. AFP was unable to confirm that the man died during the clashes.