Russian opposition activist Alexei Navalny has been sentenced to three-and-a-half years in prison in a case widely seen as an attempt to neutralise President Vladimir Putin’s most prominent critic.

In a tense hearing in Moscow’s Simonovsky court on Tuesday that intermittently descended into bouts of quarrelling between the legal teams, the judge agreed with prosecutors who alleged that Mr Navalny had violated the terms of a suspended sentence for fraud he received in 2014 by not immediately returning to Russia from Germany after recovering from nerve agent poisoning last autumn.

The judge said that the close to a year already served by Mr Navalny under house arrest would be deducted from the time to be served, meaning he will spend two years and eight months behind bars.

Mr Navalny, 44, whose corruption investigations and protests against Mr Putin’s regime have become the biggest political threat to the Kremlin, had argued he was unable to attend mandatory judicial meetings while ill because he was incapacitated. He lambasted the court as a tool of political oppression.

“The main goal of this trial is to scare a huge number of people. That’s how it works. They jail one person to scare off millions,” Mr Navalny said in a fierce speech to a room packed with journalists and diplomats.

He claims the charges against him are Mr Putin’s revenge for surviving the poisoning, which several western governments have blamed on the Kremlin, and exposing a hit squad that tracked him around the country for years, then allegedly poisoned his underpants with the nerve agent novichok. The Kremlin denies involvement.

“However much [Mr Putin] tries to portray himself as a geopolitician, a great world leader, he resents me because he’ll go into history as a poisoner. There was Alexander the Liberator and Yaroslav the Wise, and he’ll go into history as Vladimir the Underpants Poisoner,” he said.

As the judge read out the verdict, Mr Navalny smiled and drew a heart for his wife, Yulia, on the glass of the cage used to hold defendants in Russian court. “Bye. Don’t be sad. Everything will be all right,” he told her.

Mr Navalny’s jailing demonstrates the Kremlin’s increasing resolve to clamp down on dissent, analysts say. Although constitutional changes last year potentially allow Mr Putin to extend his 20-year rule until 2036, his ratings have approached record lows among Russians unhappy with stagnant real incomes and Moscow’s handling of the coronavirus emergency.

US secretary of state Antony Blinken said in a statement that Washington was “deeply concerned”. He called on Russia to free Mr Navalny and the hundreds of his supporters in custody, vowing the US would “hold Russia accountable for failing to uphold the rights of its citizens”.

Dominic Raab, UK foreign secretary, also condemned the ruling. “Today’s perverse court decision shows Russia is failing to meet the most basic commitments expected of any responsible member of the international community,” he said.

Josep Borrell, EU foreign policy chief, has vowed to press for Mr Navalny’s release during his visit to Moscow on Thursday.

As Mr Navalny and his lawyers engaged in at times aggressive and testy arguments with prosecutors during the hearing, police outside the court arrested several hundred of his supporters, according to OVD-Info, an NGO that tracks arrests.

After the verdict, a few thousand people attempted to gather in central Moscow but were viciously beaten by riot police who used rubber batons and tasers. One video on social media showed a riot policeman approach a man wearing clearly marked journalist insignia and strike him on the head so hard he fell to the ground, screaming in pain.

At least 679 people were arrested nationwide, OVD-Info said, including 557 in Moscow and 108 in St Petersburg.

Mr Navalny told the court that he hoped “people won’t take this trial as a sign they need to be more scared. The [guards] and the cage are a demonstration of weakness. You can’t jail millions of people.”

His arrest immediately after he flew back to Moscow last month sparked the biggest protests in modern Russian history. The demonstrations in more than 120 cities nationwide tapped into popular anger at corruption, injustice and plunging living standards. Police arrested more than 10,000 people over the past two weekends.

The prosecution case centred on claims that Mr Navalny missed judicial meetings mandated under the suspended sentence while in Berlin recovering from the attack and could have returned to Russia as soon as he was discharged from hospital.

“I was in a coma,” Mr Navalny said in a raised voice when prosecutors accused him of “hiding” from them in Berlin. “On what grounds are you saying you didn’t know where I was? You’re misleading the court,” he added.

Since he was detained last month, Mr Navalny has used his online following to bypass a near-total media blackout and mobilise his supporters against Mr Putin. A video he released the day after his arrest detailing a lavish $1.3bn palace on the Black Sea allegedly built for Mr Putin has racked up more than 100m views on YouTube.

Mr Putin later said the palace did not belong to him or any of his family members, but he did not address Mr Navalny’s claims that his billionaire friends managed a beneficial ownership scheme on his behalf. One of them, his childhood judo sparring partner Arkady Rotenberg, has said he is the palace’s owner and that it is intended to be a luxury apartment hotel.

Mr Navalny’s legal travails may have only just begun. He also faces up to 10 years in prison on separate charges of embezzling from his foundation, which he denies. But in court, he remained unbowed.

“When injustice and lawlessness are wearing your uniforms and passing themselves off as the law, every honest person’s duty is to resist you and fight you with everything they’ve got,” he told the court.