Robert Morgenthau, a World War II Navy hero best known as Manhattan’s legendary district attorney, and who worked as a practicing lawyer and philanthropist through his final days, died Sunday. He was 99.

He passed away at Lenox Hill Hospital after a short illness.

For four decades, Morgenthau’s patrician baritone — honed in his youth among his family friends, the Roosevelts and the Kennedys — rumbled through the halls of lower Manhattan courthouses.

In the 1960s as Manhattan US attorney, and then for 34 years until his retirement as DA at age 90, he was “The Boss” to loyal underlings and “Morgy” to tabloid headline writers.

And there were many headlines for the man who became the model for “Law and Order’s” original stern prosecutor, Adam Schiff.

By his own count, Morgenthau oversaw some 3.5 million cases as DA, guided by his often-repeated motto that justice be pursued “without fear or favor.”

His more kleig-lit prosecutions included those of mobster John Gotti (assault and conspiracy), rapper Tupac Shakur (sex assault), hip hop mogul Puffy Combs (gun possession), and actor Russell Crowe and supermodel Naomi Campbell, both of whom took no-jail deals in separate phone-flinging incidents.

His prosecution of Mark David Chapman, who pleaded guilty to killing John Lennon, was international news; that of subway vigilante Bernard Goetz sparked a national conversation on gun rights and self-defense.

His prosecution of mother-son grifters Sante and Kenneth Kimes in 2002 — for killing and robbing Upper East Side widow Irene Silverman — won the first-ever murder conviction in New York State without a body or direct evidence.

But Morgenthau often spoke of the need to fight crime not just in the streets, but “in the suites,” as in the 2005 conviction of the CEO and CFO of Tyco International for plundering the company out of $600 million.

Often his reach extended well beyond Manhattan.

Morgenthau’s sprawling investigation into the corrupt Bank of Credit and Commerce International, or BCCI, in 1991 exposed a criminal enterprise spanning 76 countries that laundered loot for Saddam Hussein, the Medellin drug cartel, and a global roster of terrorists and warlords.

His office extracted hundreds of millions of dollars in fines and forfeitures from the foreign banks Lloyds, and Credit Suisse for violating US sanctions in handling billions of dollars of Iranian origin.

“The long arm of the law,” Morgenthau enjoyed quipping to reporters in explaining why a Pakistan-based fraudster or a Swiss bank was in his clutches.

“He so deeply cared about his country and about public service, and was a true egalitarian, benevolent prince in some ways,” said Michael Cherkasky, the former Manhattan DA investigations chief who headed the BCCI case.

“I think it was the class of this guy, the gentleness, and at the same time the steel with which he approached doing justice,” said Cherkasky, who now heads the global regulatory compliance consultancy, Exiger. “Just a wonderful, wonderful warm man who was committed to public service.”

Robert Morgenthau was born in New York City in 1919.

Family legend has it that the name “Morgenthau” was chosen back in Germany sometime after 1813, when Napoleon decreed that Jews across Europe could take a family name, a right previously denied them.

Morgenthau’s Bavarian great-great-great-grandfather, Moses, in line at sunrise to register, noticed the dew on the ground and decided on “morgen,” meaning morning, and “tau,” meaning dew.

The Morgenthaus remained in Germany until 1866 — and then took America by storm. His grandfather, Henry Morgenthau Sr., rose from poverty to become US Ambassador to the Ottoman Empire during World War I.

His father, Henry Morgenthau, Jr., became Franklin Delano Roosevelt’s Treasury secretary and a major architect of the New Deal.

“There weren’t any signs saying ‘Welcome Morgenthaus,’ but the doors were open,” Morgenthau told The Post in September of his family’s journey to the US.

“This country treated immigrants so much better than we do now.”

As neighbors with estates in Dutchess County, the Morgenthau and Roosevelt families were close. Brushes with greatness were routine for the young future DA.

Morgenthau once mixed a mint julep for Winston Churchill, and grilled hot dogs with Eleanor Roosevelt for King George VI and Queen Elizabeth I, parents to the current Queen of England.

The hard-drinking Churchill pronounced his julep too strong — but drank it anyway, Morgenthau once told The Post.

As a young Naval officer, Morgenthau won two bronze stars for valor while serving as executive officer on three destroyers during WWII.

In 1944, he and his shipmates found themselves bobbing in their life vests in the Mediterranean after their ship, the USS Lansdale, was torpedoed out from under them by the Nazis.

Morgenthau was 24 years old.

Tossing in the frigid water for three hours, he made a pact with God, he told The Post in a 1999 interview marking his 80th birthday.

If he lived, he’d devote his life to public service.

“I was not in a very good bargaining position,” he quipped.

The Morgenthau and Kennedy families were also close, and after Yale Law School and twelve years practicing corporate law, the war hero made good on his pact, in 1961 accepting President John F. Kennedy’s appointment to US Attorney for Manhattan.

He was having lunch, poolside, with the president’s brother, Robert, in McLean, Virginia, on Nov. 22, 1963 — clam chowder and tuna fish sandwiches, he once remembered — when FBI Director J. Edgar Hoover called to say Kennedy had been shot.

With the exception of a failed bid for governor of New York — he was the Democratic nominee in 1962 — Morgenthau served in the federal post through the Kennedy and Johnson administrations, stonewalling the newly-elected president Nixon for months before resigning in 1969.

He was elected as Manhattan’s DA five years later, after another brief bid for the governorship in 1970, and the 1972 death, from cancer, of his first wife, Martha Pattridge, with whom he had five children.

He’d win re-election as DA another six times, working with 16 police commissioners through the administrations of five mayors and 16 police commissioners.

Supreme Court Justice Sonia Sotomayor, the late John F. Kennedy, Jr., and governors Andrew Cuomo and Eliot Spitzer are among the more notable of the thousands of prosecutors he personally interviewed and hired.

During his DA tenure, he presided over a steady succession of misbehaving Hollywood royalty, rappers, and wealthy and international crooks from behind a desk cluttered with paperwork, an ashtray holding a part-smoked cigar, and his legendary five Rolodexes.

There was Boy George, allegedly drugging (cocaine), Quentin Tarantino, allegedly slugging (at a bar brawl), and Tracy Morgan, admittedly chugging (“some beer,” as he told the cops who pulled him over in 2006.)

Prosecutions also included a hip hop who’s who, with “Tupac,” “Diddy,” “Jay-Z,” “Weezy,” “Ja Rule,” “Foxy” and “Busta Rhymes,” collared on a variety of weapons or assault charges.

Sometimes, it was the victims who were famous.

Morgenthau’s office won a grand larceny conviction against the estate-plundering son of philanthropist Brooke Astor. Among the celebrity stalking victims he defended were Uma Thurman, Sheryl Crow and George Stephanopoulos.

As his days as top prosecutor waned, he took a parting shot at Mike Bloomberg, condemning the then-mayor’s “chicken s- -t comments” over how his office handled money collected from fines, forfeitures and settlements.

On his last day of office — Dec. 31, 2009 — he asked to be remembered for his contribution to making Manhattan safe.

“In 1975, when I became district attorney, there were 648 murders in Manhattan. Last year there were 62, and this year, so far, there are 58,” he told reporters.

He also nixed plans for a bagpipers salute on his way out of his offices at One Hogan Place, because “I don’t care much for all that stuff.”

He was uncowed, to the end, by the rich and powerful.

In 1998, billionaire and Museum of Modern Art chairman, Ronald Lauder — of Estee Lauder fortune — stormed into Morgenthau’s office and demanded the DA halt the seizure of one of the museum’s masterpieces, Egon Schiele’s “Portrait of Wally,” a painting looted by the Nazis during WWII.

“It’s not my decision,” Morgenthau told the apoplectic mogul. “It’s the law.

He is survived by his wife, Pulitzer Prize-winning author Lucinda Franks and his five children, along with his grand- and great-grandchildren.

He was the founding chairman of the Museum of Jewish Heritage in Lower Manhattan, and remained active there as emeritus chair.

After his retirement, he worked most week days for Wachtell, Lipton, Rosen & Katz, serving as of-counsel at their Midtown offices and focusing on immigrant deportation cases.

In 2014, he helped found the Immigrant Justice Corps, and he remained active as emeritus chair of the Police Athletic League, which he began chairing in 1963, and where his droll humor was legendary.

“He always struggles to the podium,” PAL board member Tony Danza told The Post last year. “But he always gets laughs — it’s amazing. It’s just an inspiration, it really is.”