President Donald Trump's former lawyer Michael Cohen has provided significant assistance to special counsel Robert Mueller's investigation, including details about contacts between Trump aides and Russia, according to court documents released Friday.

But federal prosecutors in New York still recommended that Cohen receive a stiff prison sentence for his "extensive" criminal conduct, and were bitterly critical of what they called his "greed and the desire to live an opulent and lavish lifestyle."

Mueller's office said Cohen gave federal investigators "relevant and useful" information about his contacts with people connected to the White House as late as this year, according to a sentencing memo the office filed.

The memo says Cohen also offered a detailed account of the effort to build a Trump Tower in Moscow while Trump’s presidential campaign was gaining steam and gave Mueller’s team valuable information about “certain discrete Russia-related matters core to its investigation" that he learned from Trump Organization executives.

The court papers reveal for what appears to be the first time that Cohen was in contact with the Trump White House last year and this year, although it does not disclose what was discussed during that contact.

The memo also contains additional revelations related to Russia – Cohen, for instance, admitted to lying to prosecutors when he told them that, while giving a radio interview in 2015, he “spontaneously” floated the idea of Trump meeting Russian President Vladimir Putin at the United Nations General Assembly.

Cohen had in fact “conferred” with Trump about reaching out to the Russian government officials to gauge their interest in arranging such a meeting with Putin in New York, according to the court papers.

Mueller’s office also said Cohen gave them information about attempts by Russian nationals to communicate with the Trump campaign. One of them claimed to be a “trusted person” in the Russian federation who could offer the campaign “political synergy” and “synergy on a government level," the memo says.

Cohen told the investigators the Russian repeatedly proposed a meeting between Trump and Putin that he said could produce a “phenomenal" impact in matters of politics and business, according to the memo.

The prosecutors noted that Cohen didn't follow up on the invitation.

Mueller's memo, detailing Cohen's assistance to his office, took a different tone than Manhattan federal prosecutors in a separate memo filed earlier, which said Cohen's cooperation did not outweigh his criminal conduct.

In that earlier memo, the prosecutors unloaded on Cohen while describing his crimes and outlining why they were recommending he serve a "substantial term" in prison after pleading guilty to eight felony charges.

“He seeks extraordinary leniency – a sentence of no jail time – based principally on his rose-colored view of the seriousness of the crimes; his claims to a sympathetic personal history; and his provision of certain information to law enforcement,” say the court papers written by New York prosecutors. “But the crimes committed by Cohen were more serious than his submission allows and were marked by a pattern of deception that permeated his professional life.”

The prosecutors said he should be given something close to the usual federal sentence for his crimes, which would be 51 to 63 months. Cohen had requested no jail time, but prosecutors said he did not confess everything he knew.

After the filing from Mueller, Trump tweeted that it "totally clears the President. Thank you!" But in fact there was nothing in either court filing that exonerated Trump, and one portion strongly suggested that Trump was personally involved in a campaign finance violation. The Manhattan prosecutors said Cohen had paid off two women to suppress their stories about affairs with Trump — a campaign expense that was improperly not reported — and said he did so "in coordination with and at the direction of" Trump.

Though Cohen has been cooperative with the special counsel's investigation into possible collusion with Russia in the 2016 presidential election, prosecutors say his crimes were deceptive and "motivated by personal greed and ambition."

"While Cohen — as his own submissions made clear — already enjoyed a privileged life, his desire for even greater wealth and influence precipitated an extensive course of criminal conduct," says the memo filed by federal prosecutors in New York.

"Cohen did not need to commit the crimes that he did, yet he committed them for personal gain," the memo read. "He was motivated in part by greed and the desire to live an opulent and lavish lifestyle. And for all of Cohen's outward rectitude, he has lived a double life, which weighs heavily against a variance."

Mueller's office said it took no position on Cohen's sentence but said it should run concurrently with the sentence by the court in the New York case.

Cohen's lawyers had argued that he should be spared prison time given his cooperation with federal prosecutors in two separate cases. But Trump, in a scathing Twitter post earlier in the week, said his former fixer should receive a "full and complete sentence."

Cohen, who just last year boasted that he'd take a bullet for Trump, turned on his longtime boss after he became ensnared in federal investigations.

On Nov. 29, Cohen pleaded guilty to a charge brought by the special counsel's office that he lied to Congress to cover up efforts during the presidential campaign to build a Trump Tower in Moscow.

The surprise plea marked the first time that Trump and his private business dealings were named in open court as part of Mueller's probe of Russian election interference and possible ties to the Trump campaign.

Cohen admitted to lying to Senate and House intelligence committees in 2017 to minimize links between the proposed project and Trump as his presidential bid was gaining momentum.

In his plea, Cohen copped to falsely claiming that talks related to the Moscow real estate project ended in January 2016, a month before the Iowa caucuses, when in fact the discussions carried on into June of that year.

Cohen said the president and his family members were privy to the negotiations. He also admitted to communicating with Russian government officials about the deal.

The filing from the Manhattan prosecutors particularly noted Cohen's guilty plea to tax evasion — which critics of Trump have also said he has engaged in — and took pains to point out the social cost of that crime.

"Hundreds of billions of dollars are lost annually because people like Cohen — who otherwise take full advantage of all that taxes bring, such as schools, paved roads, transit systems, and Government buildings — shirk their responsibilities as American taxpayers," the prosecutors said, arguing to the court that substantial jail sentences are necessary to warn others of the consequences of tax crimes.

In the unrelated case brought by Manhattan prosecutors, Cohen pleaded guilty to eight federal charges — six counts related to his personal finances and two related to campaign finance violations involving hush money payments to two women who said they had affairs with Trump.

Cohen told a court in August that Trump directed him to make payments to two women, apparently porn actress Stormy Daniels and former Playboy model Karen McDougal, in order to secure their silence on the alleged affairs ahead of the presidential campaign.

Prosecutors say Cohen facilitated a $130,000 payment to Daniels, whose real name is Stephanie Clifford, and was involved in a $150,000 payment made by American Media Inc., the company that owns the National Enquirer, to McDougal to buy the rights to her story.

The Friday court filings come days after Mueller's office told a judge that former national security adviser Michael Flynn, who pleaded guilty to lying to the FBI about his contacts with Russia, should receive little to no prison time because of his "substantial assistance" in multiple investigations.