A Moscow court on Saturday rejected Russian opposition leader Alexei Navalny’s appeal against his prison sentence, even as the country faced a top European rights court’s order to free the Kremlin’s most prominent foe.

Speaking before the verdict, Navalny urged Russians to stand up to the Kremlin in a fiery speech mixing references to the Bible and "Harry Potter."

WHITE HOUSE SAYS NO G-7 INVITE FOR RUSSIA

A lower court sentenced Navalny earlier this month to two years and eight months in prison for violating terms of his probation while recuperating in Germany from a nerve agent poisoning that he blames on the Kremlin. Russian authorities have rejected the accusation.

Navalny, 44, an anti-corruption crusader and President Vladimir Putin’s most vocal critic, appealed the prison sentence and asked to be released. The Moscow City Court's judge on Saturday only slightly reduced his sentence to just over 2 1/2 years in prison, ruling that a month-and-half Navalny spent under house arrest in early 2015 will be deducted from his sentence.

Russian opposition leader Alexei Navalny gestures as he stands in a cage in the Babuskinsky District Court in Moscow, Russia, Saturday, Feb. 20, 2021. (AP Photo/Alexander Zemlianichenko)

Russian opposition leader Alexei Navalny gestures as he stands in a cage in the Babuskinsky District Court in Moscow, Russia, Saturday, Feb. 20, 2021. (AP Photo/Alexander Zemlianichenko)

The activist's arrest and imprisonment have fueled a huge wave of protests across Russia. Authorities responded with a sweeping crackdown, detaining about 11,000 people, many of whom were fined or given jail terms ranging from seven to 15 days.

Speaking before the verdict, Navalny referenced the Bible as well as "Harry Potter" and the animated sitcom "Rick and Morty" as he urged Russians to resist pressure from the authorities and challenge the Kremlin to build a fairer and more prosperous country.

RUSSIA MOVES TO EXTINGUISH PRO-BAVALNY 'NLASHLIGHT' PROTESTS

"The government’s task is to scare you and then persuade you that you are alone," he said. "Our Voldemort in his palace also wants me to feel cut off," he added, in a reference to Putin.

"To live is to risk it all," he continued. "Otherwise, you’re just an inert chunk of randomly assembled molecules drifting wherever the universe blows you."

Navalny also addressed the judge and the prosecutor, arguing that they could have a much better life in a new Russia.

"Just imagine how wonderful life would be without constant lying," he said. "Imagine how great it would be to work as a judge when no one would be able to call you and give you directions what verdicts to issue."

He insisted that he was unable to report to the authorities in line with his probation requirements while he was convalescing in Germany after his poisoning, emphasizing that he returned to Russia immediately after his health allowed.

"I wasn’t hiding," he said. "The entire world knew where I was."

GUN-WAVING ROBBER HOLDS UP TV REPORTER, CREW WHILE FILMING IN ECUADOR

Navalny said he was an atheist before but has come to believe in God, adding that his faith helped him face his challenges. He said he believed the Bible saying that those who hunger and thirst for righteousness are blessed, and that he felt no regret in returning home.

A police van carrying the Russian opposition leader Alexey Navalny, left, escorted by road police vehicles arrives at the Babushkinsky district court prior to the start of his trial in Moscow, Russia, early Saturday, Feb. 20, 2021. (AP Photo/Alexander Zemlianichenko)

A police van carrying the Russian opposition leader Alexey Navalny, left, escorted by road police vehicles arrives at the Babushkinsky district court prior to the start of his trial in Moscow, Russia, early Saturday, Feb. 20, 2021. (AP Photo/Alexander Zemlianichenko)

"Even though our country is built on injustice and we all face it, we also see that millions of people want righteousness," Navalny told the court. "They want the righteousness and sooner or later they will have it."

Russia has rejected Western criticism of Navalny’s arrest and the crackdown on demonstrations as meddling in its internal affairs.

In a ruling Tuesday, the European Court of Human Rights ordered the Russian government to release Navalny, citing "the nature and extent of risk to the applicant’s life." The Strasbourg-based court noted that Navalny has contested Russian authorities’ argument that they had taken sufficient measures to safeguard his life and well-being in custody following the nerve agent attack.

The Russian government has rebuffed the Strasbourg-based court's demand, describing the ruling as unlawful and "inadmissible" meddling in Russia’s affairs.

In the past, Moscow has abided by the ECHR’s rulings awarding compensations to Russian citizens who have contested verdicts in Russian courts, but it never faced a demand by the European court to set a convict free.

In a sign of its long-held annoyance with the Strasbourg court’s verdicts, Russia last year adopted a constitutional amendment declaring the priority of national legislation over international law. Russian authorities might now use that provision to reject the ECHR’s ruling.

CLICK HERE FOR THE FOX NEWS APP

Later on Saturday, Navalny will also face proceedings in a separate case on charges of defaming a World War II veteran. Navalny, who called the 94-year-old veteran and other people featured in a pro-Kremlin video "corrupt stooges," "people without conscience" and "traitors," has rejected the slander charges and described them as part of official efforts to disparage him.