Police in Azerbaijan have raided a mosque in the capital, surrounding the building and expelling worshippers.
Campaigners say they fear for the future of religious freedoms
Some members of the congregation said they were kicked and punched as police entered during morning prayers.
Officials denied there was violence, saying police were carrying out a court order to close Juma mosque in Baku.
The local imam, Ilgar Ibrahimoglu, is a leading human rights campaigner and was
until recently the country's most prominent political prisoner.
The authorities later announced they were replacing him with a state-sanctioned cleric.
About 30 people were attending morning prayers at the mosque in Baku's Old City on Wednesday when police wielding truncheons burst through the doors.
Many of the congregation said they received injuries as police officers rounded them up and threw them out of the building.
About 100 police surrounded the building and refused to let anyone inside, said the BBC's Chloe Arnold in Baku.
"Today the worshippers were driven out of the mosque by force... Freedom of worship is being violated," said Mr Ibrahimoglu.
"This is a return to Stalinism. It is a step back to the sort of thing that Azerbaijan thought it had left in the past."
Earlier this year, a court ordered the closure of the 1,000-year-old mosque.
This followed the trial of Mr Ibrahimoglu, who was jailed for taking part in protests after a disputed presidential election last year that saw a landslide victory for the previous leader's son.
But under pressure from the international community, Mr Ibrahimoglu received a suspended sentence.
Human rights groups say they fear for the future of religious freedom in Azerbaijan following Wednesday's raid.
There are rumours that the city's authorities are planning to turn the mosque into a carpet museum, which is what the building was used for during the Soviet era.
A spokesman for the Azeri justice ministry, Hussein Alikhanov, said worshippers at the mosque were warned repeatedly to vacate the premises.
"But they refused to do this... so this morning we carried out the decision of the court. There was no force and no violence used and we did not beat up any one."
Some 150 worshippers were allowed back into the mosque for afternoon prayers, but were told a new imam had been appointed to replace Mr Ibrahimoglu.
"It is essential to have an official appointee," Haji Jabrail
Mikailov, deputy chief of the directorate, told reporters.
"The state is the state. Who's going to run the country if not the
Worshippers reacted angrily to the news. "It's nonsense," said one, who did not want to be identified. "How can you just appoint a chief cleric without even asking the believers?"