For years, prosecutors debated, fought and even, in at least two cases, resigned over the fate of the Manhattan district attorney’s investigation into Donald J. Trump. Some legal experts predicted it would be the downfall of the district attorney, Alvin L. Bragg.

But on Thursday, a jury swiftly and decisively vindicated the risky strategy that Mr. Bragg employed to bring 34 felony counts against the former president.

Prosecutors were helped by state election law, two judges who allowed their novel legal theory to proceed and their ability to make the most of a high-risk witness, Mr. Trump’s former fixer, Michael D. Cohen.

The jury’s verdict — guilty on all 34 felony counts — represented a landmark victory for Mr. Bragg, who claimed a place in history as the first prosecutor to indict, prosecute and convict a former U.S. president.

“I did my job,” he said at a news conference after the verdict. “Our job is to follow the facts without fear or favor and that’s what we did here.”