The leaders of Tanzania's main opposition party Chadema have been released on bail, a party spokesman said on Tuesday, after they were detained ahead of a youth day rally.
As many as 520 people were arrested across the country, according to a police statement overnight, before a banned rally on Monday that had been expected to draw thousands of young people in the southwestern city of Mbeya.
Rights organisations condemned the detentions as "troubling", with government opponents voicing fears the police action could signal a return to the oppressive policies of late president John Magufuli.
Those released included Chadema chairman Freeman Mbowe and his deputy Tundu Lissu -- both former presidential candidates -- as well as John Mnyika and John Pambalu, according to party spokesman John Mrema.
He posted on X that they "have been returned to Dar es Salaam by police and have bailed themselves out".
However, he added that "some leaders" continue to be held, without giving further details.
Overnight Awadh Haji, police chief of operations and training, said "all the top Chadema leaders who were arrested, after interrogation and other procedures, have been returned to where they came from".
The party posted on X on Tuesday that party offices in Mbeya "are surrounded by the police and they are not allowing people to enter the offices."
Police had warned in a statement they would "take strict legal action against any individual or group involved in disrupting peace".
It added officers would continue to closely monitor the situation and would "strengthen security in the city of Mbeya and all other regions of Tanzania to prevent any planned acts of violence."
Mbowe, 62, was detained on Monday at the airport in Mbeya, the day after several other leaders including Lissu were detained.
Hundreds of youth supporters were rounded up by police as they travelled into the city, according to the party. Some 10,000 had been expected to meet in Mbeya to mark International Youth Day on Monday.
But police accused the party of planning violent demonstrations and made reference to widespread anti-government protests in neighbouring Kenya, led largely by young activists.
Rights groups and government opponents had voiced fears the police action could signal a return to the oppressive policies of late president John Magufuli as Tanzania gears up for national elections due late next year, as well as local polls in December.
The arrests came despite his successor Samia Suluhu Hassan vowing a return to "competitive politics" and easing some restrictions on the opposition and the media, including the January 2023 lifting of a six-year ban on opposition gatherings.
Oryem Nyeko, a researcher at Human Rights Watch, said on Monday: "It's troubling because it's very similar to the mass opposition arrests we saw when Magufuli was president."