MOSCOW — The European Court of Human Rights ruled on Tuesday in favor of a Russian man who was detained during a political rally in Moscow in 2012 and later sentenced to two weeks in jail for jaywalking.

The ruling was a rebuff to the Russian practice of cracking down on political rallies with harsh fines and jail time. It undermined a central element of Moscow’s narrative of the clashes — that unruly protesters had set off the violence, thus justifying new laws cracking down on public assembly.

The police arrested about 400 people, including the plaintiff in the case, Yevgeniy Frumkin, after scuffles broke out at the rally, on May 6, 2012, in Bolotnaya Square.

The demonstration followed a series of large, peaceful protests by people who opposed the election in March 2012 of Vladimir V. Putin to a third term as president, and who suspected fraud during voting.