MOSCOW — Aleksei A. Navalny, Russia’s most prominent opposition leader, appeared in court on Tuesday at a hearing that could send him to a lengthy prison term in a far-flung penal colony for the first time.
The Russian authorities have signaled that they will not be swayed by public pressure to release Mr. Navalny, the 44-year-old anticorruption activist. They have put several of his top allies under house arrest, and on Sunday they deployed a huge police force in cities across Russia to quell protests over the past couple of weeks calling for his freedom.
“Hundreds of thousands cannot be locked up,” Mr. Navalny said during the hearing. “I really hope that more and more people will recognize this. And when they recognize this — and that moment will come — all of this will fall apart, because you cannot lock up the whole country.”
In anticipation of more protests on Tuesday, a heavy presence of riot police officers in body armor, camouflage and black helmets cordoned off the Moscow neighborhood surrounding the courthouse. Officers stood in front of entrances to the nearest subway station and checked people’s documents, and parking lots around the station were filled with police vans carrying reinforcements. The police detained at least 237 people, according to the activist group OVD-Info.
The court weighed the prosecution’s accusation that Mr. Navalny had violated parole on a three-and-a-half-year suspended prison sentence that he received in 2014. He and his brother were convicted of stealing about $500,000 from two companies, a conviction that the European Court of Human Rights called “arbitrary and manifestly unreasonable.”
Mr. Navalny and his allies, along with many independent analysts, see his prosecution as an effort by President Vladimir V. Putin to silence his loudest critic.
Under the terms of that earlier sentence, the authorities say Mr. Navalny was supposed to check in with the prison authorities at least twice a month. But prosecutors charge that he repeatedly failed to do so last year, including after being released from a Berlin hospital in September while recovering from an assassination attempt by poisoning.
Toward the end of the hearing, Mr. Navalny delivered a fiery speech to the courtroom in which he blamed Mr. Putin for trying to lock him away. He said the Russian president was angry that Mr. Navalny had survived after being poisoned with the military-grade nerve agent Novichok in August, in what he and Western officials have described as a state assassination attempt.
Mr. Navalny has accused Russia’s domestic intelligence agency of trying to kill him on orders from Mr. Putin by applying Novichok to the opposition leader’s underwear. The Kremlin has denied involvement in the poisoning.
“His main resentment against me now is that he will go down in history as a poisoner,” Mr. Navalny said of Mr. Putin. “There was Alexander the Liberator and Yaroslav the Wise. Now we’ll have Vladimir the Poisoner of Underpants.”
Mr. Navalny’s associates have said that only street protests can force the Kremlin to change course, and tens of thousands of people have rallied for Mr. Navalny each of the last two weekends in cities across Russia.
Early in the hearing, Mr. Navalny — confined to a glass box for defendants, as is typical in Russia — smiled often and maintained his sense of humor. When the judge, Natalia Repnikova, asked him to introduce himself, he replied, “Your honor, you forgot to introduce yourself.”
When Ms. Repnikova asked for his current address, he deadpanned: “Pre-trial Detention Facility No. 1.”
During a break in the proceeding, Mr. Navalny, in slacks and a dark hoodie, paced back and forth in his box. At one point he looked up at the depiction of the French philosopher Montesquieu and other luminaries on the grand courtroom’s wood-paneled wall.
The prosecution called for three and a half years in prison for Mr. Navalny, minus the amount of time he spent under house arrest related to the case, which was about a year. The prosecutor, Yekaterina Frolova, said Mr. Navalny was guilty of “systematic violations of obligations placed on him by the court.”
Mr. Navalny sparred repeatedly with Ms. Frolova, calling her “an honorable daughter of the regime,” but then adding, “You lie in every word.” He said he was being prosecuted to scare millions of other Russians out of rising up against Mr. Putin.
The choreography of the hearing appeared designed to portray due process being granted to Mr. Navalny. Officials moved the hearing from a courtroom outside Moscow to a bigger one in the city — in order, they said, to allow more journalists to be present.
Two sculpted judicial scales flanked the Russian double-headed eagle above the robed judge. Ms. Repnikova, the judge, peppered the prosecution with pointed questions, probing its arguments. Mr. Navalny was allowed to give his fiery speech, and criticize the judge and prosecutor, with few interruptions. But journalists were barred from filming the proceedings or taking pictures.
The prosecution’s case for sending Mr. Navalny to prison relied heavily on technicalities. A prison service official, Aleksandr Yermolin, read in a soft voice from a stack of papers detailing Mr. Navalny’s alleged parole violations. The prosecution said the violations had begun before Mr. Navalny’s poisoning last August.
At one point Mr. Yermolin cited online posts showing that Mr. Navalny was moving freely across Germany while not reporting for his parole last year. At another point, the prosecutor, Yekaterina Frolova, responded to an argument from Mr. Navalny’s lawyers by taking issue with the day of the week on which the defendant had contacted the parole authorities.
“Jan. 9 was a Thursday, which has nothing at all do to with a Monday,” the prosecutor said.
Mr. Navalny and his lawyers, in a lengthy back-and-forth with the prosecution, insisted that they had properly notified parole officials of his inability to report in person because of his poisoning. Mr. Navalny noted that even Mr. Putin had publicly referred last year to Mr. Navalny’s being in treatment in Germany.
Mr. Navalny was confined to house arrest for much of 2014 and served repeated jail terms of several weeks at a time. Until now, though, he has never served a lengthy prison sentence.
Analysts say the Kremlin’s calculus has long been that Mr. Navalny could be more of a liability behind bars — as Russia’s most prominent political prisoner — than walking free as an often-controversial opposition activist.
That thinking appears to have changed as the Russian public’s frustration with Mr. Putin has increased, along with Mr. Navalny’s prominence.
After his poisoning, Mr. Navalny was airlifted in a coma to Berlin, where he recovered. He returned to Moscow last month, even though the Russian authorities made it clear that he would face years in prison.
He was jailed upon arrival, after which his team released a report by Mr. Navalny that described a purported secret palace built for Mr. Putin. The report has been viewed more than 100 million times on YouTube, energized the pro-Navalny protests and underscored the opposition leader’s ability to reach a huge audience on Russia’s mostly free internet.
The Kremlin on Tuesday again sought to minimize the significance of Mr. Navalny’s case, issuing a veiled warning to the European Union’s top foreign policy official, Josep Borrell Fontelles, who plans to visit Moscow this week.
“We hope that there will not be something as silly as tying the future of Russian-European relations to the case of this pre-trial detention center inhabitant,” the Kremlin spokesman Dmitri S. Peskov said, according to the Tass state news agency.
Ivan Nechepurenko contributed reporting.