Russian anti-Putin campaigner Alexei Navalny has denounced his detention as "blatantly illegal" in an appeal hearing via video link.
A judge heard, and then rejected, his appeal against detention for 30 days.
He was arrested on 17 January for not complying with a suspended sentence. He had only just arrived from Berlin, where he spent months recovering from a near-fatal Russian nerve agent attack.
Thousands of Navalny supporters protested across Russia last Saturday.
The authorities say he was supposed to report to police regularly because of a suspended sentence for embezzlement.
But his lawyers called this "absurd", saying the authorities knew he was being treated in Berlin for the Novichok poisoning, which happened in Russia last August.
Mr Navalny, Russia's most prominent opposition leader, told the judge on Thursday "this is all massively, blatantly illegal".
His lawyers protested that Mr Navalny's hasty trial at a police station on 18 January had lacked transparency and that they had been denied access to him.
Mr Navalny also complained he had not been allowed to speak to his lawyers in private since his arrest. Then the judge did allow that to happen briefly.