Former deputy Trump campaign chairman Rick Gates was sentenced to 45 days in jail Tuesday, for crimes that could have put him in prison for up to six years, after providing what a federal judge described as vital information for special counsel Robert S. Mueller III’s investigation of Russian interference in the 2016 election.

“He’s had to testify, be identified as a known cooperator in the glare of public attention at a time of deep political division in our society, when people are demonized for being on the other side, and he was seen as turning on his own side,” U.S. District Judge Amy Berman Jackson said in Washington federal court. “Gates’s information alone warranted, even demanded further investigation from the standpoint of national security, the integrity of our elections and enforcing criminal laws.”

The former globe-trotting lobbyist and right-hand man to Trump campaign chairman Paul Manafort can serve his sentence on weekends. Gates also must spend three years on probation, pay a $20,000 fine and perform 300 hours of community service.

“I greatly regret the mistakes that I have made, and I have worked hard to honor my commitment to make amends,” Gates said, quickly reading through prepared remarks.

Gates, 47, asked for no jail time, and prosecutors did not oppose that request, given the scope of his testimony against Manafort, campaign associate Roger Stone and Democratic power lawyer Gregory B. Craig. Manafort and Stone were both convicted at trial, while Craig was acquitted.

Jackson said determining Gates’s sentence was “extraordinarily difficult.” She said she had to balance Gates’s “extremely candid” testimony on “matters of grave and international importance” against his crimes of lying to the FBI and conspiring to conceal tens of millions of dollars he and Manafort earned lobbying for Ukraine.

Jackson said it was “hard to overstate the amount of lies” and money involved in Gates’s fraud, which included helping his former boss launder $18 million made in Ukraine while pocketing $3 million himself.

The scheme cheated American taxpayers out of more than $6 million that could have gone to pay for schools, roads and veterans’ care, Jackson said, while hiding the agenda of their pro-Russian Ukrainian clients from Congress and the public eye.

But the judge gave Gates credit for taking responsibility and cooperating. She cited in particular his revelation that Manafort in 2016 shared internal Trump campaign polling data and discussed advancing a Ukrainian peace plan backed by Russia with an aide the FBI assessed to have Russian intelligence connections.

Manafort lied about those interactions, leading to the collapse of his plea agreement with the special counsel.

“Not all witnesses with knowledge cooperated, and not all who cooperated testified truthfully, and many communications were lost when deleted, or encrypted and not saved,” Jackson said.

During Manafort’s 2018 trial in Virginia, defense attorneys hammered Gates’s credibility, pressing him to admit to jurors that he had embezzled from his boss, kept mistresses and doctored tax returns.

Tuesday’s sentencing came more than two years after Gates and Manafort in October 2017 became the first people publicly charged in Mueller’s investigation of Russian election interference, which ultimately led to convictions for six Trump aides or associates.

Information Gates provided, Jackson said, showed that “there was ample basis for decision-makers at the highest level of the Department of Justice” to investigate whether there was any coordination between the campaign and foreigners interfering in the election, or possible obstruction of justice.

Assistant U.S. Attorney Molly Gaston called Gates’s cooperation “extraordinary” in the face of intense media coverage, pressure from Manafort and his supporters and powerful interests opposed to his testimony.

“Mr. Gates stands out as someone who amid such circumstances did the right thing,” Gaston said.

Gates, she said, provided information used in a dozen search warrant applications and has agreed to continue cooperating in “ongoing investigations” detailed in sealed court filings.

Gates, of Richmond, has complied with three congressional subpoenas and spent more than 500 hours with federal and state prosecutors, his attorney Thomas Green said. He cooperated with prosecutors while caring for his wife, who has been diagnosed with breast cancer, and their four children.

Manafort served as Donald Trump’s campaign chairman until August 2016, when he resigned over his past work in Ukraine for its former president, Viktor Yanukovych, and his pro-Russian political party. However, Gates remained until Election Day, working at one point for the Republican National Committee, and then became deputy chairman of Trump’s inaugural committee.

Manafort was sentenced early this year to 71/2 years in prison in both cases for conspiring to defraud the United States conspiring to tamper with witnesses and committing bank and tax fraud to buy properties and support his lavish lifestyle.

In the illegal-lobbying case against Craig in September, Gates testified that the former Democratic White House counsel contacted a reporter as part of Manafort’s Ukraine efforts in 2012. Craig was found not guilty of lying to the Justice Department about those media contacts.

In Stone’s trial in November, Gates revealed details of the Trump campaign’s intense interest — shared by the candidate himself — in Stone’s efforts to learn about Democratic emails the government alleged were hacked by Russia and released by the anti-secrecy group WikiLeaks. The emails, the government alleged, were released by WikiLeaks to derail Trump’s Democratic opponent, Hillary Clinton.

Stone, who was convicted last month, faces sentencing in February for tampering with a witness and lying to Congress about the scope of his efforts.