Robert Morgenthau, who died Sunday at age 99, was Manhattan DA for 34 years — not only setting the record for the city’s longest-serving prosecutor but, in the words of the late Mayor Ed Koch, setting “the standard for district attorneys. As La Guardia was for mayors, Morgenthau has been for district attorneys.”

He had a solid career even before winning that job in 1974, with nine years as the US attorney for the Southern District and as a US Navy hero during World War II.

“Morgy,” as he was known in the tabloids, was death on white-collar crime long before a certain state attorney general started posing as the “sheriff of Wall Street.” He even went global in his landmark case against the Bank of Credit and Commerce International, whose corrupt money-laundering touched 76 countries.

As his hand-picked successor as Manhattan DA, Cyrus Vance Jr., told The Post, Morgenthau also created the nation’s first sex-crimes unit and was “integral in the reduction of violent crime in Manhattan through aggressive prosecution” of violent felons.

His famed prosecutions included John Lennon killer Mark David Chapman, subway vigilante Bernard Goetz, mob boss John Gotti and “Preppy Killer” Robert Chambers.

In retirement, he remained active with charities close to his heart — the Museum of Jewish Heritage and The Police Athletic League — while also doing pro bono work in immigration and death-row cases.

These pages had strong differences with Morgenthau over the years, but there’s no doubt that New York City and the world are far better for his long life of service.

Rest in peace, sir.