Former nine-term U.S. Rep. William Jefferson is going free, at least for now, a federal judge has ruled.

In a blockbuster order, U.S. District Judge T.S. Ellis, of Virginia, has thrown out seven of the 10 charges for which Jefferson, the disgraced ex-congressman from New Orleans, was sent to federal prison on a 13-year sentence.

Ellis on Wednesday ordered Jefferson's immediate release pending a Dec. 1 resentencing date for the three corruption charges that the judge upheld.

Jefferson, now 70, entered the federal prison system in May 2012 after being allowed to remain free pending his earlier appeals. He has since served more than five years.

Ellis ruled that the instructions he gave the jury at Jefferson's 2009 trial about the definition of an "official act" — a question at the heart of the allegations that Jefferson sold his office for cash — were too broad with regard to those seven charges in light of a landmark U.S. Supreme Court decision last year.

Jefferson began his sentence, the longest ever handed to a congressman, at a federal prison in Texas. He was transferred to the federal prison camp in Oakdale, Louisiana, in January 2014.

Jefferson's scheduled release date was in 2023, but that date now is uncertain.

"Because there is no assurance that Jefferson would be required to serve a sentence beyond what he has already served," Ellis wrote, he was ordering "his immediate release, followed by a prompt resentencing."

The judge threw out counts 3, 4, 6, 7, 12, 13 and 14. Those include two counts of solicitation of bribes by a public official, two counts of depriving citizens of honest services by wire fraud and three counts of money laundering.

Ellis kept intact Jefferson's convictions on counts 1, 2, and 16: conspiracy to solicit bribes, conspiracy to violate the Foreign Corrupt Practices Act, and violating the Racketeer Influenced Corrupt Organization Act, or RICO.

The judge had sentenced Jefferson to 60 months — which he has already served — on the first two counts. But his conviction on the RICO charge came with a 156-month sentence.

Jefferson's attorney, Robert Trout, declined to comment on how Ellis' order might affect Jefferson's sentence.

"We're still reviewing the opinion, but we are obviously very pleased that Judge Ellis ordered Mr. Jefferson's immediate release," Trout said.

Just when Jefferson might be released is uncertain. A call to the prison Thursday was not returned.

Joshua Stueve, a spokesman for U.S. Attorney Dana Boente's office for the Eastern District of Virginia, declined to comment on Ellis' ruling or whether prosecutors will appeal.

A Justice Department spokesperson, Nicole Navas Oxman, said the agency is "reviewing the ruling and considering its options."

The decision marked the latest upending of a political corruption conviction since the high court set tighter limits on what qualifies as an illegal quid pro quo in politics.

In a unanimous 2016 decision tossing out the conviction of former Virginia Gov. Bob McDonnell, Chief Justice John Roberts wrote that an official act "must involve a formal exercise of governmental power."

Roberts added that "setting up a meeting, talking to another official or organizing an event — without more — does not fit that definition of 'official act.' "

Federal prosecutors declined to retry McDonnell, and the high court's ruling ignited a barrage of fresh legal challenges by convicted former politicians across the country.

Among them was Jefferson, whose appeals had appeared to reach an end when the Supreme Court declined to review his conviction in 2012.

Jefferson stood trial in the same Eastern District of Virginia court as McDonnell, and his attorneys argued successfully that the two cases were cut from the same cloth.

Jefferson was found guilty of 11 of the 16 charges he faced, including bribery, "honest services" wire fraud, money laundering and racketeering. A federal appeals court later upheld his convictions on 10 of those counts.

The charges against Jefferson related largely to allegations that — in exchange for payments to himself and family members — he made introductions and helped swing business deals between Americans and government officials in western Africa.

Prosecutors offered evidence that Jefferson wrote to the African officials on his congressional letterhead, that his staff arranged trips there and that Jefferson set up meetings with foreign and U.S. agency officials in a scheme with his alleged bribers.

But Jefferson's attorneys have long argued that, despite the infamous $90,000 in cash found in his freezer, wrapped in foil, nothing he did was criminal.

Jefferson tried only to influence the actions of African government officials, they said, arguing that federal prosecutors wildly stretched a theory of what constitutes official business in Congress.

In their latest bid, they pointed to a federal appeals court's ruling in 2015 that found the disputed jury instructions in McDonnell's case "to a large extent" mirrored the ones Ellis gave to the jury that convicted Jefferson.

Citing the McDonnell ruling, Ellis wrote that the flawed jury instructions tainted the verdict against Jefferson on seven charges, but not three others.

He left little doubt that even though the McDonnell decision forced his hand, it didn't change his view of Jefferson's actions.

"No one reading this opinion should conclude that Jefferson was innocent of crime; he was not innocent of crime. Even by McDonnell’s standard he engaged in and was convicted of some criminal conduct," Ellis wrote in a 41-page order.

"The Supreme Court described Gov. McDonnell’s actions as 'tawdry' and 'distasteful.' Jefferson's actions went well beyond being 'tawdry' and 'distasteful'; they were plainly venal and reflected corrupt intent," he wrote. 

Ellis ruled that Jefferson should be released under the same conditions that applied while he was free pending his appeal. He will be subject to 24-hour GPS monitoring. He can travel to Washington, D.C., to meet with his attorneys but otherwise can't leave southeastern Louisiana without court approval.

"We give all praise, all glory and all honor to God. He has done this for us and we're happy to have my husband come home," said Jefferson's wife, Andrea Jefferson.

She said she was expecting the former congressman to be released from Oakdale late Thursday or Friday.

The court ruling didn't come as a complete surprise, she said. "We knew based on McDonnell we had a good case," she said.

Ellis agreed that the jury instruction was wrong in light of the McDonnell decision. He then weighed, for each count, whether it had a "substantial and injurious effect on the jury's verdict."

Ellis said the jury would have convicted Jefferson regardless on a pair of conspiracy charges. The first involved a conspiracy to violate the Foreign Corrupt Practices Act, based on Jefferson's solicitation of money and company shares from iGate, a Kentucky telecommunications firm, in exchange for promoting the firm's technology.

Jefferson's efforts on behalf of iGate, in exchange for payments to a company owned by his family members, spanned several years and multiple trips to Africa, where he met with government officials.

A meeting in July 2005, during which Jefferson allegedly offered a bribe to the Nigerian vice president, spurred his downfall. A business associate, Lori Mody, had begun working as a federal informant. With the FBI's help, she gave Jefferson a briefcase containing $100,000 in marked cash to pay the bribe.

The FBI raided Jefferson's homes and offices a few days later, seizing $90,000 of the marked cash from the freezer of his Washington, D.C., home.

"Although Jefferson never completed the bribe, completion of the act is not necessary to prove that Jefferson took part in a conspiracy," Ellis wrote in refusing to vacate that count.

Ellis also upheld the second conspiracy count and the RICO conspiracy charge, which related to a variety of other schemes for which Jefferson was convicted.

The judge cited "extensive testimony" that Jefferson pressured the U.S. Trade Development Agency to bankroll a feasibility study on a fertilizer plant in Nigeria on behalf of businessman John Melton and his company, TDC Energy Overseas.

Jefferson had solicited payments from Melton and, earlier, from businessman George Knost, who had sought Jefferson's help with sugar and oil field projects in Nigeria.

The deals with both men, and others, included payments to Jefferson's brother and chief political strategist, Mose Jefferson, who is now dead.

Ellis found that Jefferson's pressure on the government agency amounted to official acts and that the erroneous jury instruction for those counts was harmless.

Tulane law professor Tania Tetlow, a former federal prosecutor, said the sentencing guidelines that Ellis will consider in resentencing Jefferson could shift downward if the dollar amounts from the vacated bribery counts are stripped from the calculation.

But the fact that Jefferson is now convicted of fewer crimes may not matter.

"The guidelines are based on the activity that was the basis of the conviction, not on the number or types of counts, necessarily," Tetlow said. "It is possible that this (ruling) won't affect the sentence, but it really depends on the particular guidelines."

Still, Tetlow called Ellis' decision to immediately release Jefferson "a very rare move, and that may be a signal ... that the judge is considering a lesser sentence."

Carl Tobias, a Richmond School of Law professor who has followed the Jefferson case, described Ellis as a well-respected judge who "went out of his way" to excoriate the former congressman in his ruling.

"He can't abide public corruption. As a judge, he thinks that's about the worst thing you can do," Tobias said.

Still, "I think he's thinking to himself, given what happened with McDonnell, it wipes out a lot of the government's case, and maybe Jefferson's going to be serving time he shouldn't have served," Tobias said. "Maybe there's some sympathy there."

Jefferson is not alone in gaining a reprieve in the wake of the McDonnell ruling.

In early July, a federal appeals court panel in New York overturned the corruption conviction of Sheldon Silver, the former speaker of the New York State Assembly, for the same reason. Silver was convicted in 2015 on charges he took nearly $4 million in secret payments in return for official acts. Prosecutors have vowed to retry him.

Follow John Simerman on Twitter, @johnsimerman.