MOSCOW, Oct 8 (Reuters) - A Russian court on Tuesday ordered a critic of President Vladimir Putin confined to a psychiatric ward indefinitely over clashes with police at a protest, a ruling likened by rights activists to abuses of psychiatry during the Soviet era to jail dissidents.

Mikhail Kosenko, who had undergone outpatient psychiatric treatment before his arrest, was among more than two dozen accused of rioting at a protest in Moscow on May 6, 2012, the eve of Putin's inauguration to a new six-year term.

They are held up by the opposition as victims of a Kremlin crackdown on dissent. Critics accuse Putin of using the courts to sideline opponents since he rose to power in 2000, citing the imprisonment of former oil tycoon Mikhail Khodorkovsky and members of punk group Pussy Riot.

A Russian judge sentenced Kosenko, who has been in pre-trial detention for 16 months, to indefinite detention and compulsory treatment in a psychiatric institution.

He was accused of assaulting a police officer - although the officer testified that he did not recognise Kosenko and did not want him punished. Kosenko denies the charges.

"The court has come to the conclusion that at the time the action was committed by Kosenko... he was in a state of insanity," Judge Ludmila Moskalenko told the court.

Protesters demonstrating outside the courthouse chanted "Shame!" They at times drowned out her reading of the ruling. Police detained nine protesters, activists said.

"This is a clear case of a return to punitive psychiatry in Russia," said Alexander Podrabinek, a human-rights activist and Soviet-era dissident who authored a book on the political abuse of psychiatry under the Soviet Union. "This is the first such clear and obvious instance in the post-Soviet period."

Kosenko's family says he takes medication for a psychiatric disorder after a trauma sustained during military service, but was non-violent and has no prior police record.

Locked in the defendant's cage, the moustachioed 38-year-old greeted the verdict in silence.

"The most valued thing in the country is freedom," he wrote in comments published by Novaya Gazeta on Tuesday.

"Demonstrators (on May 6 2012) took to the streets in protest of unfair elections... The authorities are against fair and just elections because then they would be no more."

Human rights activists say video evidence presented in courts shows Kosenko standing by while other protesters scuffle with police. They say reports of violence at the May protest were exaggerated by the police and prosecution.

"The guilty slant (and) the political character of this process is completely obvious," said rights activist Oleg Orlov. (Reporting by Valeri Stepchenkov and Olga Petrova; Writing by Alissa de Carbonnel; Editing by Mark Heinrich)