The bribery trial of Sen. Robert Menendez (D-N.J.) ended in a mistrial Nov. 16, which is seen as a major victory for the senator who fought 18 counts of alleged corruption. (Reuters)

Sen. Robert Menendez (D-N.J.) declared himself back from the political dead Thursday, after his months-long bribery trial ended in a mistrial that could spell long-term difficulties for the federal government’s ability to pursue corruption cases.

Menendez, a senior lawmaker who has spent years fighting the charges, broke down crying as he addressed cheering supporters outside the courthouse.

“Today is Resurrection Day,’’ he said. “Anyone who knows me knows I never seek a fight, but I never shy away from one either. This was not a fair fight.’’

Now, Menendez said, “I’m going back to Washington to fight for the people of New Jersey.’’ And he added an ominous warning: “For those who were digging my political grave so they could jump into my seat, I know who you are and I won’t forget it.’’

The senator’s jubilation may be short-lived. Justice Department officials said they would review the case to decide whether to put him on trial again, and Senate Majority Leader Mitch McConnell (R-Ky.) called for a Senate ethics probe based on the charges in the case.

The jury of seven women and five men twice sent out notes this week saying it was deadlocked. “We cannot reach a unanimous decision,’’ the jury said in the second note just before noon Thursday. “Nor are we willing to move away from our strong convictions.”

U.S. District Judge William Walls then privately questioned the jurors, and declared a mistrial.

One of the jurors, Ed Norris, said Menendez and the doctor on trial with him, Salomon Melgen, came close to an outright acquittal, with 10 jurors believing Menendez not guilty, and only two on the panel in favor of finding him guilty.

Norris, a 49-year-old equipment operator from Morris County, said that the evidence was mostly emails and that he “didn’t see a smoking gun.’’

“I don’t think the government proved anything,’’ Norris said. “I didn’t see anything bad that he did.’’

Norris said that the panel was clearly divided from the moment deliberations began, but that it did not get angry or acrimonious.

Eventually, though, “we had enough of being deadlocked,’’ he said.

A mistrial is a major victory for a senator who had to fight 18 counts of alleged corruption, and a setback for the Justice Department, whose efforts to combat public corruption have been curtailed by a recent Supreme Court decision.

Prosecutors said Menendez took gifts from Melgen, including a luxury hotel stay, private jet flights and campaign donations, in exchange for which he tried to help Melgen get U.S. visas for his girlfriends, intervened in the doctor’s $8.9 million billing dispute with Medicare, and assisted with a port security contract of the doctor’s in the Dominican Republic.

Melgen is awaiting sentencing for a previous conviction for defrauding Medicare. The two men were on trial for bribery, and Menendez was also accused of lying on government disclosure forms about his finances when he did not report gifts of flights paid for by Melgen — an omission the senator calls an accidental oversight, not a criminal lie.

Menendez’s lawyers said that the government, by charging the senator, was trying to criminalize a longtime friendship between the two men, and that there was nothing corrupt about Menendez’s acts on Melgen’s behalf or Melgen’s financial support of Menendez.

Menendez’s lawyer Abbe Lowell said the jury “could not, would not and did not return a verdict that validated any of the government’s charges. This is what happens when you put a real 25-year friendship on trial.’’

Melgen’s lawyer, Kirk Ogrosky, said he would have preferred an acquittal but added: “Maybe we’ll get that chance again.’’

A Justice Department spokeswoman said prosecutors “will carefully consider next steps in this important matter and report to the Court at the appropriate time.”

Left unclear Thursday was whether Menendez would be able to return to his perch as top Democrat on the Senate Foreign Relations Committee. Sen. Benjamin L. Cardin (Md.) has served as the panel’s ranking Democrat since Menendez’s indictment. Senior Democratic aides would not comment Thursday on any potential change in committee assignments, signaling that no final decision would be made until after the Justice Department determines whether to retry Menendez.

Barbara Van Gelder, a lawyer who specializes in white-collar crimes, predicted the department would put Menendez back on trial.

Public integrity prosecutors “would rather lose than drop a case, so they’ll probably go back and streamline their case, and next time be a lot more precise and surgical in terms of evidence,’’ she said. “Once you blur business with friendship, it’s very hard to ask the jury to untangle that. . . . The jury is looking for a concrete quid pro quo, not just a plausible quid pro quo.’’

Just before the mistrial was declared, prosecutors had asked the judge to issue a clarifying instruction to the panel, telling jurors that they could reach verdicts on individual counts in the indictment, even if they couldn’t find agreement on all the counts. The judge rejected that suggestion, saying to do so would be “going down the slippery slope of coercion.’’

The jury heard nine weeks of testimony before beginning deliberations last week, when it quickly became clear there were sharp divisions.

On Nov. 9, an excused juror said she would have acquitted the senator but predicted that the trial would end in a hung jury.

Then, on Monday afternoon, the jury sent the first note saying it was unable to reach a verdict. Walls sent the panel home early that day, telling jurors to come back fresh and try again.

“I realize you are having difficulty reaching a unanimous decision, but that’s not unusual,” Walls told the panel the next morning. He said jurors should decide the case for themselves but shouldn’t hesitate to reexamine their views. “This is not reality TV; this is real life,” Walls said.

The admonition did not resolve the impasse. During a smoking break Wednesday outside the courthouse, five jurors huddled in a group chatting, while a sixth male juror stayed away, smoking alone.

Menendez’s lawyers had repeatedly asked the judge to declare a mistrial over various evidentiary and procedural issues.

Although mistrials are generally considered wins for defense lawyers and losses for prosecutors, the Justice Department will probably feel significant internal pressure to put the senator on trial again, because recent Supreme Court decisions have raised questions about how much legal authority prosecutors still have in pursuing corruption charges involving payments not explicitly linked to official acts.

Some legal experts have warned that a defeat for the government in the Menendez case could make prosecutors more reluctant to pursue public corruption cases in the future.

A guilty verdict, on the other hand, could have had major ramifications in the Senate, where Republicans hold a narrow majority. If Menendez had been convicted, there would probably have been pressure on him to resign, or for fellow senators to expel him. If his seat had become vacant before mid-January, New Jersey Gov. Chris Christie (R) would have been able to appoint his successor, probably turning a Democratic seat Republican until a November 2018 midterm election. But it was not clear that even if Menendez had been convicted, he and his fellow Democrats would have gone along with his ouster.

To try to prove their case, prosecutors called pilots, government officials and even a former lawmaker, former senator Tom Harkin, to the witness stand to describe how Menendez pushed and prodded officials on behalf of Melgen. At times, those witnesses delivered a mixed message to jurors.

Harkin, an Iowa Democrat, said that he had a meeting with Menendez about Melgen’s billing dispute as a “common courtesy’’ among senators — suggesting he didn’t see anything nefarious about the interaction.

The defense spent much of its time putting witnesses on the stand, including Sens. Cory Booker (D-N.J.) and Lindsey O. Graham (R-S.C.), to vouch for Menendez’s character.

The trial took place against the backdrop of last year’s Supreme Court ruling that overturned the corruption conviction of former Virginia governor Robert F. McDonnell (R).

Walls tailored his jury instructions to conform to his reading of the McDonnell ruling, which narrowed the definition of an “official act” by a politician.

“This is the first major post-McDonnell trial, and it does suggest that public corruption offenses are going to be much tougher to prove,’’ said Kelly Kramer, a lawyer specializing in white-collar work.