Former national security adviser Michael Flynn asked a federal judge Tuesday evening for permission to withdraw his guilty plea of lying to the FBI in special counsel Robert S. Mueller III’s probe of Russian election interference, alleging that prosecutors breached his cooperation agreement by demanding his false testimony.

The stunning reversal — more than two years after Flynn pleaded guilty Dec. 1, 2017, and two weeks before he faces sentencing — threatens to sidetrack, if not derail, the prosecution of the highest-ranking Trump official charged and one of the first to cooperate with Mueller’s office.

Any change in plea must be approved by a judge.

Attorneys for Flynn alleged that after the former adviser to President Trump switched defense teams last June, prosecutors demanded that he falsely admit that he knowingly lied in filing forms with the Justice Department that hid his lobbying firm’s work for the government of Turkey.

“Michael T. Flynn hereby moves to withdraw his plea because of the government’s bad faith, vindictiveness, and breach of the plea agreement,” defense attorney Sidney Powell wrote.

Powell asked U.S. District Judge Emmet G. Sullivan in Washington to postpone the former Army lieutenant general’s sentencing until at least Feb. 27, “to allow time for the government to respond . . . and for Mr. Flynn to provide the additional briefing he needs to protect the record and his constitutional rights.”

The filing came one week after U.S. prosecutors recommended that Flynn serve up to six months in prison, reversing their earlier recommendation of probation after his attacks against the FBI and the Justice Department.

The government revoked its request for leniency weeks after Sullivan rejected Flynn’s earlier claims that he had been duped into pleading guilty to lying to FBI agents about his Russian contacts after the 2016 U.S. election.

It is clear that the defendant has not learned his lesson. He has behaved as though the law does not apply to him, and as if there are no consequences for his actions,” prosecutor Brandon Van Grack wrote in arguing that the government no longer considered his cooperation “substantial.”

Flynn, 61, pleaded guilty in 2017 to lying about his communications with then-Russian Ambassador Sergey Kislyak during the presidential transition.

In a cooperation deal, Flynn became a key witness in a probe of the administration that he had served for 24 days — the shortest tenure of a national security adviser on record — before resigning in February 2017.

However, soon after Mueller’s investigation formally ended in March of last year, Flynn broke with the prosecutors who had credited him with helping them.

Flynn faces up to a five-year prison term under the charge, which includes his misrepresentation of work advancing the interests of the Turkish government. However, ahead of his initially scheduled sentencing in December 2018, prosecutors said he deserved probation for his “substantial assistance” in several investigations.

In a November 2018 filing, the special counsel’s office noted that Flynn’s “early cooperation was particularly valuable because he was one of the few people with long-term and firsthand insight regarding events and issues under investigation.”

Flynn admitted to being in touch with senior Trump transition officials before and after his pre-inauguration communications with Kislyak, which involved efforts to blunt Obama administration policy decisions on sanctions on Russia and a United Nations resolution on Israel.

Prosecutors had earlier cited Flynn’s “exemplary” public service, including 33 years in the military and combat service, to warrant a possible sentence of probation.

But at the December 2018 sentencing hearing, Sullivan lambasted Flynn’s attorneys for appearing to play down his offenses. Under questioning by the judge, Flynn repeated under oath that he admitted he was guilty. Sullivan recited at length Flynn’s misstatements to Vice President Pence, senior White House aides, federal investigators and the news media before and after Trump’s January 2017 inauguration about the nature of his foreign contacts.

“Arguably, you sold your country out,” Sullivan told Flynn, warning that he might impose prison time. Flynn’s lawyers agreed to postpone the proceeding so he could continue to show his good-faith cooperation.

Last summer Flynn switched defense lawyers, who asked Sullivan to find prosecutors in contempt, alleging that Flynn had been entrapped into pleading guilty.

Flynn also broke with prosecutors in the July federal trial of his former business partner Bijan Rafiekian on charges of illegally lobbying for Turkey. Flynn was set to be the star witness against Rafiekian. He told a grand jury that he and Rafiekian campaigned “on behalf of elements within the Turkish government,” a project that included an op-ed under Flynn’s name on Election Day in 2016. But just before the trial, Flynn claimed that prosecutors wanted him to lie. A jury convicted Rafiekian without Flynn’s testimony, but a judge threw out those convictions in part because he found “insufficient” evidence of a conspiracy between the two men or of the Turkish government’s role.

In Tuesday evening’s filing, Flynn’s attorneys repeated those claims and said it was only after Powell replaced Flynn’s initial legal team, from the Covington & Burling law firm, on June 17 that prosecutors for the first time demanded his admission and testimony that he knowingly signed a Foreign Agents Registration Act (FARA) form containing several false statements about the scope and nature of his firm’s work for Turkey.

“Not only was that demanded testimony a lie, but also, the prosecutors knew it was false, and would induce a breach,” Powell said.

Powell added that if there were mistakes in the filing, they were a result of Covington’s interviews of multiple people, its consultations with the Justice Department and the firm’s judgment calls “as it navigated this inscrutable area of the law.”

However, Flynn also blamed prosecutors, saying that they “concocted the alleged ‘false statements’ [in the FARA filing] by their own misrepresentations, deceit, and omissions.”