A federal judge on Tuesday blasted Michael Flynn while delaying the sentencing of President Donald Trump’s former national-security adviser.

U.S. District Judge Emmet G. Sullivan criticized Flynn for his links to Turkey. “You were an unregistered agent of a foreign country while serving as the national-security adviser to the president of the United States,” said Sullivan, according to multiple published reports. “That undermines everything this flag over here stands for. Arguably, you sold your country out.”

The judge later backtracked, as a prosecutor said Flynn stopped acting as a foreign agent in mid-November 2016. Sullivan apologized for his remarks, saying he “felt terrible,” reported CBS News correspondent Steven Portnoy. Flynn’s consulting firm received $530,000 to work for Turkish interests in a contract that ended Nov. 15, 2016, according to a Wall Street Journal report.

Sullivan — a judge in Washington, D.C., who was appointed to the federal bench by President Bill Clinton — then delayed sentencing, after suggesting to Flynn’s attorneys that they might want to ask for a delay given that the former Trump adviser could cooperate further with prosecutors.

Special counsel Robert Mueller’s team earlier this month recommended no jail time for Flynn. Federal prosecutors backed leniency for the former aide because Flynn had provided “substantial assistance” to the government on both the special-counsel probe and a separate criminal investigation.

Flynn’s sentencing hearing had been scheduled for Tuesday and comes after he pleaded guilty a year ago to lying to investigators about his contacts with Russia’s ambassador a month before Trump’s inauguration.

Read more:Mueller releases memo on Flynn’s interview with FBI

And see:Trump pushes back on Mueller probe

Flynn played a big role in Trump’s presidential campaign, famously appearing on stage at the Republican National Convention. “Lock her up,” Flynn said at the convention in Cleveland, referring to Trump’s opponent, Democrat Hillary Clinton. “If I did a tenth of what she did, I would be in jail today.”