In this Aug. 17, 2017, file photo, U.S. Sen. Bob Menendez, D-N.J., speaks during a news conference in Union Beach, N.J. Credit: Julio Cortez | AP

U.S. prosecutors told a judge they want to drop a federal corruption case against Sen. Robert Menendez rather than retry him after a divided jury failed to reach a verdict last year.

The decision lifts a legal cloud over the New Jersey Democrat as he faces re-election in November and represents a quiet surrender by prosecutors who pursued a criminal case against him for five years.

“From the very beginning, I never wavered in my innocence and my belief that justice would prevail,” Menendez said in a written statement. “I am grateful that the Department of Justice has taken the time to reevaluate its case and come to the appropriate conclusion. I thank God for hearing my prayers and for giving me strength during this difficult time.”

The Justice Department said it abandoned the case after U.S. District Judge William Walls ruled last week that the trial evidence and testimony persuaded him that Menendez was not guilty on four criminal counts. Walls left in place other bribery and fraud charges but bowed out of the case. The retrial had been assigned to U.S. District Judge Jose Linares.

Linares held a 15-minute status conference with lawyers in the case on Wednesday morning, and prosecutors filed their motion to dismiss the case less than an hour later, court records show.

“Given the impact of the court’s Jan. 24 order on the charges and the evidence admissible in a retrial, the United States has determined that it will not retry the defendants on the remaining charges,” Justice Department spokeswoman Nicole Navas Oxman said in a written statement.

A trial would have been a major political liability for Menendez, a leading Hispanic lawmaker, as he prepares for a re-election campaign in which he is favored and faces no major Republican challenger.

Even if he had been convicted and forced to step down, the seat would likely have remained in Democratic hands because it would be filled by New Jersey’s new Democratic governor, Phil Murphy. Republicans hold a 51-49 majority in the chamber, where Senate Majority Leader Mitch McConnell has called for an Ethics Committee investigation of Menendez.

Menendez and his co-defendant, Salomon Melgen, a wealthy Florida eye doctor accused of bribing the senator in exchange for political favors, have maintained their innocence since the investigation began in late 2012. During an 11-week trial that ended Nov. 16 with a hung jury, defense lawyers had argued that the two men were close friends who had no corrupt intent. Melgen faces sentencing for a separate fraud conviction in Florida.

Kirk Ogrosky, a lawyer for Melgen, said: “Five years ago today, FBI agents started this ill-fated adventure that destroyed my client’s life when the raided his office in West Palm Beach. Dr. Melgen is now and has always been innocent of the charges brought in New Jersey. He did not ever give anything to his best friend of over 20 years with an expectation that he would get something in return.

“We take no pleasure in seeing justice done at this stage in a case that should never have been brought,” Ogrosky said. “All that said, justice today is better than continuing on to inevitable acquittals on the remaining counts. We hope that this type of meritless case is never again brought by DOJ.”

After the mistrial, one juror said the panel had favored acquittal on most of the 18 counts by a 10-2 margin. He said that prosecutors failed to persuade him that the men had engaged in bribery.

Walls acquitted Menendez and Melgen of seven of the 18 counts in their indictment. He dismissed three counts of bribery against Menendez and three against Melgen that involved more than $750,000 in political contributions benefiting the senator’s 2012 re-election campaign. Walls ruled that prosecutors failed to meet a higher legal standard for campaign contributions: that they were exchanged for a specific action.

The senator was still accused of taking bribes in the form of private jet travel and a Paris vacation in exchange for pushing the doctor’s business interests at the highest levels of the U.S. government. He also faced a false-statements count.

The decision to abandon the case didn’t surprise Robert Mintz, a former U.S. prosecutor.

“Any time you have a political corruption case that doesn’t include a cooperating witness, you’ve got a difficult case to prove,” Mintz said. “There were no wiretaps, conversations, videos or cooperating witnesses. Those are typically the pillars on which a public corruption case is built. So it was always to going to be difficult for prosecutors.”

Another former U.S. prosecutor, Lee Vartan, said that the case was weak from the start and that the Justice Department shouldn’t have pursued a retrial. Prosecutors lacked smoking-gun evidence and failed to prove a corrupt bargain between the senator and the doctor, he said.

“Anyone who works in this world was surprised this case was brought,” he said. “This is the way things work in Washington. This case was almost criminalizing the political process.”

Menendez attorney Abbe Lowell, who clashed often with prosecutors and Judge Walls during the trial, said the Justice Department “made the right decision to end this case” and that Menendez never wavered in his innocence.