WASHINGTON (Reuters) - A U.S. judge fiercely criticized President Donald Trump’s former national security adviser Michael Flynn on Tuesday for lying to FBI agents in a probe into Russian interference in the 2016 election, and delayed sentencing him until Flynn has finished helping prosecutors.

U.S. District Judge Emmet Sullivan told Flynn, a retired U.S. Army lieutenant general and former director of the Defense Intelligence Agency, that he had arguably betrayed his country. Sullivan also noted that Flynn had operated as an undeclared lobbyist for Turkey even as he worked on Trump’s campaign team and prepared to be his White House national security adviser.

Flynn pleaded guilty to lying to FBI agents about his December 2016 conversations with Sergei Kislyak, then Russia’s ambassador in Washington, about U.S. sanctions imposed on Moscow by the administration of Trump’s Democratic predecessor Barack Obama. The conversations took place between Trump’s November election victory and his inauguration in January 2017.

Special Counsel Robert Mueller, leading the investigation into possible collusion between Trump’s campaign and Russia ahead of the election, had asked the judge not to sentence Flynn to prison because he had already provided “substantial” cooperation over the course of many interviews.

Lying to the FBI carries a statutory maximum sentence of five years in prison. Flynn’s plea agreement stated that he was eligible for a sentence of between zero and six months.

Sullivan sternly told Flynn his actions were abhorrent, noting that Flynn had also lied to senior White House officials, who in turn misled the public. The judge said he had read additional facts about Flynn’s behavior that have not been made public.

At one point, Sullivan asked prosecutors if Flynn could have been charged with treason, although the judge later said he had not been suggesting such a charge was warranted.

“Arguably, you sold your country out,” Sullivan told Flynn. “I’m not hiding my disgust, my disdain for this criminal offense.”

Flynn, dressed in a suit and tie, showed little emotion throughout the hearing, and spoke calmly when he confirmed his guilty plea and answered questions from the judge.

Sullivan appeared ready to sentence Flynn to prison but then gave him the option of a delay in his sentencing so he could fully cooperate with any pending investigations and bolster his case for leniency. The judge told Flynn he could not promise that he would not eventually sentence him to serve prison time.

Flynn accepted that offer. Sullivan did not set a new date for sentencing but asked Mueller’s team and Flynn’s attorney to give him a status report by March 13.

Sullivan later imposed travel restrictions on Flynn, ordering him to surrender his passport and to obtain court permission before traveling outside the Washington area. The curbs are typical for people released on their own recognizance, the judge said.

Prosecutors said Flynn already had provided most of the cooperation he could, but it was possible he might be able to help investigators further. Flynn’s attorney said his client is cooperating with federal prosecutors in a case against Bijan Rafiekian, his former business partner who has been charged with unregistered lobbying for Turkey.

Slideshow ( 9 images )

Rafiekian pleaded not guilty on Tuesday to those charges in federal court in Alexandria, Virginia. His trial is scheduled for Feb. 11. Flynn is expected to testify.

Prosecutors have said Rafiekian and Flynn lobbied to have Washington extradite a Muslim cleric who lives in the United States and is accused by Turkey’s government of backing a 2016 coup attempt. Flynn has not been charged in that case.

‘LOCK HER UP!’

Slideshow ( 9 images )

Flynn was a high-profile adviser to Trump’s campaign team. At the Republican Party’s national convention in 2016, Flynn led Trump’s supporters in cries of “Lock her up!” directed against Democratic candidate Hillary Clinton.

A group of protesters, including some who chanted “Lock him up,” gathered outside the courthouse on Tuesday, along with a large inflatable rat fashioned to look like Trump. Several Flynn supporters also were there, cheering as he entered and exited. One held a sign that read, “Michael Flynn is a hero.”

Flynn became national security adviser when Trump took office in January 2017, but lasted only 24 days before being fired.

He told FBI investigators on Jan. 24, 2017, that he had not discussed the U.S. sanctions with Kislyak when in fact he had, according to his plea agreement. Trump has said he fired Flynn because he also lied to Vice President Mike Pence about the contacts with Kislyak.

Trump has said Flynn did not break the law and has voiced support for him, raising speculation the Republican president might pardon him.

“Good luck today in court to General Michael Flynn. Will be interesting to see what he has to say, despite tremendous pressure being put on him, about Russian Collusion in our great and, obviously, highly successful political campaign. There was no Collusion!” Trump wrote on Twitter on Tuesday morning.

After the hearing, White House spokeswoman Sarah Sanders told reporters the FBI had “ambushed” Flynn in the way agents questioned him, but said his “activities” at the center of the case “don’t have anything to do with the president” and disputed that Flynn had committed treason.

“We wish General Flynn well,” Sanders said.

In contrast, Trump has called his former long-time personal lawyer Michael Cohen, who has pleaded guilty to separate charges, a “rat.”

Mueller’s investigation into Russia’s role in the 2016 election and whether Trump has unlawfully sought to obstruct the probe has cast a shadow over his presidency. Several former Trump aides have pleaded guilty in Mueller’s probe, but Flynn was the first former Trump White House official to do so. Mueller also has charged a series of Russian individuals and entities.

Trump has called Mueller’s investigation a “witch hunt” and has denied collusion with Moscow.

Russia has denied meddling in the election, contrary to the conclusion of U.S. intelligence agencies that have said Moscow used hacking and propaganda to try to sow discord in the United States and boost Trump’s chances against Clinton.