Charges against five bloggers and journalists held in Ethiopia for more than a year have been dropped, weeks before Barack Obama’s planned visit to the country.

Five others also arrested in April 2014 remain in jail, accused of planning terrorist attacks and collaborating with the US-based opposition group Ginbot 7, labelled a terrorist organisation by Ethiopia.

“The release of these five journalists is a welcome turn of events in Ethiopia, where the number of journalists in prison has steadily increased in recent years,” said Tom Rhodes, east Africa representative at the Committee to Protect Journalists (CPJ).

“We call on authorities to release the remaining Zone 9 bloggers and all the journalists in jail for their work, and to drop all charges against them,” he said in a statement on Thursday.

The CPJ said that at least 12 other journalists were still incarcerated, most of them facing terrorism charges, making Ethiopia the second-worst jailer of journalists in Africa, after its neighbour Eritrea.

Ethiopia is an ally of the west in the fight against Islamist extremism in east Africa, receiving millions of dollars in foreign aid, but has a dire record when it comes to human rights and press freedom.

In elections in May, the ruling Ethiopian People’s Revolutionary Democratic Front coalition, in power since the end of a civil war in 1991, and its allies won every seat in parliament.

Obama is due to visit Ethiopia later this month as part of an Africa tour that includes a trip to Kenya, where his father was born. In Ethiopia, Obama is expected to meet the prime minister, Hailemariam Desalegn, and address the African Union at its Addis Ababa headquarters.

In the unexpected move on Wednesday, state prosecutors dropped all charges against journalists Asmamaw Hailegiorgis, Edom Kassaye and Tesfalem Waldyes, and bloggers Mahlet Fantahun and Zelalem Kibret.

Four other members of Zone 9, a blogging collective, remain in prison while one other was charged in absentia. The Zone 9 website, proclaiming “we blog because we care”, features mostly social and political commentary, often critical of the government.