In the most high-profile rights case here in years, the imprisonment and trial of the women, members of a punk band called Pussy Riot, drew worldwide condemnation of constraints on political speech in Russia. Rallies in support of them were held in dozens of cities around the world on Friday, including Paris, New York and London, where demonstrators appeared outside the Russian Embassy wearing balaclavas, the bandâs trademark headgear.

Human rights groups and Western governments, including the United States, immediately criticized the verdict as unjust and the sentence as unduly severe. Because the women acted as a group, they had faced a maximum sentence of seven years in prison. Prosecutors had urged a three-year sentence. The stiff punishment was handed down by a Moscow judge, Marina Syrova, who described the women as posing a danger to society and said they had committed âgrave crimesâ including âthe insult and humiliation of the Christian faith and inciting religious hatred.â

Â As word of the sentences spread, a crowd of protesters outside the courthouse howled angrily, and then seemed to fall into a stunned silence. Sporadic protests and violent arrests continued throughout the evening.

While the courtroom emptied, the three women were left in their glass enclosure, nicknamed the âaquarium,â and photographers were allowed to take pictures. As she was finally led away, the most outspoken of the three, Nadezhda Tolokonnikova, said, âWe are happy because we brought the revolution closer!â A police officer snapped back, âWell done.â

Lawyers for the women said they intended to appeal the decision.

Russia has seen an upwelling of dissent since disputed parliamentary elections last December, including demonstrations that drew tens of thousands of people onto the streets of Moscow. But the Pussy Riot case in recent weeks morphed into an international sensation, and focused intense attention on the efforts of the recently reinstalled president, Vladimir V. Putin, to clamp down on the opposition.

This was partly because of the sympathetic appearance of the defendants â" two are mothers of young children â" and partly because their group uses music to carry its message. But it also set them in a David-and-Goliath struggle against a formidable power structure: the Kremlin and the Russian Orthodox Church.

But while the case has allowed critics of Mr. Putin to portray his government as squelching free speech and presiding over a rigged judicial system, it has also given the government an opportunity to portray its political opponents as obscene, disrespectful rabble-rousers, liberal urbanites backed by the West in a conspiracy against the Russian state and the Russian church.

The extent of the culture clash was evident this month when Madonna paused during a concert in Moscow to urge the release of the women, who have been jailed since March, and performed in a black bra with âPussy Riotâ stenciled in bold letters on her back. The next day, Dmitry Rogozin, a deputy prime minister, posted a Twitter message calling Madonna a âwhore.â

On Friday, the Russian Orthodox Church issued a statement that referred to Nazi aggression and the militant atheism of the Soviet era, and said, âWhat happened is blasphemy and sacrilege, the conscious and deliberate insult to the sanctuary and a manifestation of hostility to millions of people.â

The saga began in February when the women infiltrated the Cathedral of Christ the Savior wearing colorful balaclavas, and pranced around in front of the golden Holy Doors leading to the altar, dancing, chanting and lip-syncing for what would later become a music video of a profane song in which they beseeched the Virgin Mary to rid Russia of Mr. Putin.

Security guards quickly stripped them of their guitars, but the video was completed with splices of footage from another church.

Because of the support they have received from stars like Madonna and Sting, the women of Pussy Riot have become more famous, at least outside Russia, than other political opposition leaders here, some of whom are also the subjects of investigations and prosecutions.

But while the women become minor celebrities, Pussy Riot is far more political than musical: Its members have never commercially released a song or an album, and they do not seem to have any serious aspirations to do so.

When their trial opened late last month, the women apologized, saying they had never intended to offend the Orthodox church but rather sought to make a political statement against Mr. Putin and against the church patriarch, Kirill I, for supporting Mr. Putinâs campaign for a third term as president.

But Judge Syrova, delivering her decision, said that the political comments were spliced into the video later, and that the action in the church was therefore motivated by religious hatred. She also cited evidence that the women had psychological disorders, and she criticized them for embracing feminism, though she noted that âbelonging to feminism in the Russian Federation is not a legal violation or a crime.â

Although the guilty verdict was widely expected, there were several heartbeats of silence in the courtroom after Judge Syrova finished reading her decision. Then, from somewhere in the gallery came shouts of âShame!â and âDisgrace!â

The defendants, Ms. Tolokonnikova, 23, Yekaterina Samutsevich, 30, and Maria Alyokhina, 24, standing in the glass-plated enclosure in which they were held throughout the trial, smiled to each other as the sentences were announced and rolled their eyes.

Outside the courthouse, supporters of the group chanted âFree Pussy Riot!â and clashed with the riot police. Dozens were arrested, including the former chess champion Garry Kasparov, who is active in the Russian political opposition. Mr. Kasparov fought with the police and appeared to be beaten as he was bundled into a police vehicle.

In Washington, where Obama administration officials followed the trial closely, seeing it as a measure of Mr. Putinâs new presidency and its own troubled relations with Russia, the White House and the State Department each criticized the verdict. The State Department all but called on Russiaâs higher courts to overturn the conviction and âensure that the right to freedom of expression is upheld.â

A White House spokesman, Tommy Vietor, said the verdict was disappointing and the sentences disproportionate. âWhile we understand that the groupâs behavior was offensive to some, we have serious concerns about the way these young women have been treated by the Russian judicial system,â he said.

Amnesty International condemned the sentences, which a spokeswoman said show âthat the Russian authorities will stop at no end to suppress dissent and stifle civil society.â

Mr. Putin, commenting on the case briefly while in London for the Olympics this month, had said that he hoped the women would not be judged âtoo severely,â but that the decision was the courtâs to make.

Mr. Putinâs spokesman, Dmitry Peskov, said after the verdict that the president had made his views on the case clear. But Mr. Peskov told the Interfax news agency, âHe does not have the right to impose his view on the court.â The trial also showcased the often tilted nature of the judicial system. Defense lawyers were barred from calling most of the witnesses they wanted, including experts and some eyewitnesses, even as prosecutors were allowed to call witnesses who had only seen the Pussy Riot performance on video.

The women were given limited time to meet with their lawyers and also complained that they were not sufficiently fed or well rested.

Stanislav O. Samutsevich, the father of the oldest defendant, said that he had hoped for leniency. âGiven that they have been imprisoned for five months, I hoped the sentence would be suspended,â he said in an interview outside the court.

Mr. Samutsevich said that the women were at once going through a classic case of Russian repression, while also getting caught up in a new alliance between church and state.

âThis is the experience all generations of Russian people went through,â he said. âOur people were sent to prisons under all governments.â But, he added, âI think that we are rolling down to the practices of Iran, where one can get into prison for religious crimes, or Saudi Arabia. Is that what we want to see here?â