MOSCOW — On his return to Russia Sunday, five months after he left in a coma from a near-fatal poisoning, Kremlin critic Alexei Navalny made it as far as border control.

Before Navalny’s passport could even be stamped, police officers at Moscow’s Sheremetyevo Alexander S. Pushkin International Airport surrounded and detained him. He gave his wife a hug and a kiss goodbye before being led to a private room.

The 44-year-old opposition leader’s arrest was expected, but he chose to fly to Russia anyway. Before his arrival, Russian authorities said he was on a wanted list for allegedly violating the terms of his suspended sentence from a 2014 embezzlement conviction. Navalny and the European Court of Human Rights have called that case a political prosecution.

But the move to jail him could have far-reaching consequences for the government of President Vladimir Putin. Navalny says Putin ordered Russian state security agents to poison him with a nerve agent during a trip to Siberia in August. The Kremlin has denied the accusation.

Navalny’s team said Sunday that the chaos surrounding his return, including the diversion of his flight to Sheremetyevo after supporters gathered at the Moscow airport where he was scheduled to land, show just how serious a threat Putin considers Navalny.

His arrest is expected to trigger protests by his supporters, and a response from Western governments, perhaps in the form of more sanctions, is also possible.

“Mr. Navalny should be immediately released, and the perpetrators of the outrageous attack on his life must be held accountable,” Jake Sullivan, President-elect Joe Biden’s choice for national security adviser, tweeted Sunday. “The Kremlin’s attacks on Mr. Navalny are not just a violation of human rights, but an affront to the Russian people who want their voices heard.”

Secretary of State Mike Pompeo, in a statement on Sunday, condemned Navalny’s arrest, saying that the United States is concerned about the latest attempt to silence him and demanding his immediate release. “Confident political figures do not fear competing voices, nor commit violence against or wrongfully detain political opponents,” he said.

Amnesty International declared Navalny a “prisoner of conscience” Sunday night.

Russia’s Federal Penitentiary Service said Navalny would be in police custody “until a court ruling.” It’s unclear when his case will be heard. Hours after his detention, his spokeswoman tweeted that his exact whereabouts were not known.

Navalny, standing before a backdrop of the Kremlin at the Sheremetyevo airport before he went to border control, said Sunday was his “best day in the past five months.”

“This is my home,” he said. “I came here, and everybody is asking, ‘Aren’t you afraid?’ No, I am not afraid.”

Navalny arrived from Berlin, where he was treated for his poisoning, including more than two weeks in a medically induced coma. He was escorted onto the flight by German security officials for his protection: Two black Audis with tinted windows surrounded by police cars could be seen on the tarmac. Airport officials warned watching journalists they weren’t allowed to take pictures.

As Navalny made his way to his seat in the 13th row, reporters on the plane lobbed questions at him. He encouraged them to take their seats and fasten their seat belts so the flight could take off on time.

Asked what he expected in Moscow, Navalny replied with his trademark humor: Subzero temperatures, he said, and a warm welcome. He took a selfie with the flight attendants and watched the Cartoon Network series “Rick and Morty” during the flight.

At Moscow’s Vnukovo International Airport, where Navalny was scheduled to arrive, riot police were deployed to disperse a gathering crowd. More than 50 people were detained, according to the monitoring group OVD-Info.

A large group at the airport said they were waiting for pop star Olga Buzova. Navalny’s team called it a Kremlin-backed effort to compete with his supporters.

As Navalny’s flight neared Vnukovo, flight radar showed it turning away, and its arrival was pushed back. Then the arrivals board showed that the plane had been diverted to Sheremetyevo.

On the plane, the captain announced that “a technical issue” caused the change. Other flights were diverted, too, and Navalny later apologized to affected passengers.

“I didn’t believe it until the last minute,” Navalny said on the plane. “There are several planes in the air above Vnukovo Airport right now, and they’re keep passengers in the air because they are afraid.”

At the news, some of the crowd started to leave Vnukovo. “I think if we all head to Sheremetyevo now, they’ll turn the plane back around to Vnukovo,” said Danila Buzanov, 25.

Buzanov called Navalny a Nelson Mandela-like figure. He said his arrest would only make things worse for the Kremlin. Navalny’s return, he said, “is such a brave thing to do, and it’s such a message for people of how to not be afraid and fight until the end.”

Tatiana Stanovaya, head of political analysis firm R. Politik, wrote on the Telegram messaging app that Navalny’s arrest will trigger protests that would test “how far [Russian security services] and the most repressive apparatus of the state can go.”

Despite the late change in airport, Navalny’s supporters showed up at Sheremetyevo, and chanted the name of Navalny’s wife, Yulia, as she exited the border control area.

In a video interview released Oct. 6, Alexei Navalny said he believed Russia's intelligence services poisoned him with a Novichok nerve agent. (Reuters)

In Berlin earlier Sunday, Ekaterina Raykova-Merz and Andreas Merz-Raykov waited to greet Navalny before his departure, holding up a sign that read, “The time of dictators has come to an end. Putin is afraid of Navalny.”

German doctors have said Navalny was poisoned with a nerve agent similar to the Soviet-era Novichok, which was used to poison former Russian double agent Sergei Skripal and his daughter in Salisbury, England, in 2018. Western intelligence blamed Russian agents for that poisoning.

The investigative website Bellingcat reported last month that telecommunications and travel data show that eight Russian state security agents were in the vicinity when Navalny was poisoned in Tomsk.

The Kremlin has denied any role in Navalny’s poisoning and has rebuffed Western calls for an investigation.

Putin, during a December news conference, seemed to confirm that Navalny was being watched, but denied that Moscow was responsible for his poisoning. Without referring to Navalny by name, Putin laughed and asked: “Who needs him anyway? If we had really wanted, we’d have finished the job.”

Andrei Kolesnikov, chairman of the Russian Domestic Politics Program at the Carnegie Moscow Center, tweeted that “Navalny’s reception by the authorities at the airport is the best evidence of how afraid they are of him.”

“They themselves are inflating the importance of Navalny,” Kolesnikov said. “This disavows Putin’s ironic question: ‘Who needs him?’ ”

But the government’s messaging on Navalny — alleging without evidence that he’s working with the CIA — has had some success in shaping Russian public opinion.

Forty-nine percent of Russians polled by the independent Levada Center in late December said the poisoning was either staged or “a provocation of Western special services.” Just 15 percent said it was an attempt by authorities to eliminate a political opponent.

Navalny’s return under threat of arrest could boost his popularity. Other prominent activists, such as businessman Mikhail Khodorkovsky and chess legend Garry Kasparov, continue to criticize the Kremlin, but from abroad.

Ruslan Karadanov, who went to the Berlin airport Sunday to show support, said he thought Navalny was “very brave” to go back.

“If he wants to continue his political activity, he has no other choice,” he said. “Here in Germany, he’ll just be forgotten.”

In announcing his planned homecoming, Navalny said he “never considered the choice whether to go back or not.”

“I never left,” he said on Instagram. “I ended up in Germany, arriving there in an intensive care box, for one reason: they tried to kill me.”

Morris reported from Berlin. Karen DeYoung in Washington and Natalia Abbakumova and Katya Korobtsova in Moscow contributed to this report.