Russia's opposition leader Alexei Navalny has been sentenced to 30 days' administrative arrest for repeatedly violating the law on staging rallies.
He was detained at his home in Moscow earlier on Monday, ahead of anti-corruption demonstrations in Russia.
Hundreds of people were held during the gatherings across the country.
Riot police in central Moscow were picking protesters out of the crowd at random, a BBC correspondent at the demonstration has said.
A court in Moscow announced its verdict late on Monday, rejecting demands by Alexei Navalny's defence lawyers to drop the case.
The 41-year-old opposition leader later confirmed this in a tweet on his Twitter page (in Russian).
Mr Navalny, who intends to stand for the Russian presidency next year, had been due to attend the unauthorised rally in the capital earlier on Monday.
OVD-Info, an independent NGO, said that 825 people had been detained at the protest in the capital.
Police in Moscow say about 5,000 took part in the demonstration there, Interfax news agency reports.
OVD-Info also said that hundreds of people were held in St Petersburg.
Russia's interior ministry says about 3,500 people attended the protest in the north-western city, and 500 were detained.
'Many young plucked from the crowd' - by BBC's Sarah Rainsford, central Moscow
This was a peculiar protest.
At first it was hard to tell who was taking part. Tverskaya Street was full of families marking Russia Day with entertainers in historical costumes.
Then thousands of protesters turned up. Huge numbers of riot police were right behind them.
First they announced that the rally was illegal then the arrests began. We saw dozens of people plucked from the crowd - many of them young - and dragged roughly towards police buses.
By calling people to an unauthorised rally, Alexei Navalny knew he was risking a confrontation. The police duly obliged.
But people I spoke to said they knew the risk and still wanted their voices to be heard. Among other things, those voices chanted loudly: "Putin, thief!" and "Russia will be free".
In a live broadcast by the Russian liberal TV channel, Dozhd, protesters in St Petersburg could be heard shouting "shame" as they were detained by police. Among those arrested was Maxim Reznik, the city's legislative assembly deputy.
Prominent activist Daniil Ken said he was arrested as he left his home in St Petersburg. He urged people to join the rally at the city's Champ de Mars square. "Go for me, please!" he tweeted. He has since been released.
Police had earlier detained several people at demonstrations in the cities of Vladivostok, Blagoveshchensk and Kazan.
What are the protests about?
Mr Navalny called on Russians to take to the streets on Monday - Russia Day - to express their anger at alleged corruption at the highest levels.
The anti-corruption campaigner uses YouTube, tweets and blogs to reach new audiences.
A video posted in March accuses Russian Prime Minister Dmitry Medvedev of accumulating a vast private fortune. Mr Medvedev denies the claims. The video, which includes the accusation that the PM has a duck house on one of his properties, has been viewed nearly 23 million times.
In a call for people to join him on Monday, Mr Navalny wrote: "I want changes. I want to live in a modern democratic state and I want our taxes to be converted into roads, schools and hospitals, not into yachts, palaces and vineyards."
Mr Navalny was earlier granted permission to hold a rally at Sakharova Avenue but changed the location - without permission - on the eve of the demonstration to Tverskaya Street, near the Kremlin.
The protest was called over government plans to demolish Soviet-era apartment blocks in the city.
Permission was granted for demonstrations in 169 locations across the country, some of which were broadcast live on the Navalny Live YouTube channel.
The protests coincided with a series of official events - including festivals, concerts and military enactments - taking place across the country to mark Russia Day, the national holiday dedicated to the 1990 declaration of sovereignty.
Similar rallies led by Mr Navalny in March led to hundreds of arrests.
Those protests were the largest since 2012, drawing thousands of people - including many teenagers - to rallies nationwide, angered by a report published by Mr Navalny that accused Prime Minister Dmitry Medvedev of corruption.