NEW YORK — Long before former New York City Mayor Rudolph Giuliani joined Donald Trump’s team, spending his days as a surrogate for the real estate developer’s presidential campaign, he was a U.S. attorney who successfully prosecuted one of the biggest corruption cases in New York City history. Among those convicted in the case was a partner in a law firm long associated with Trump.

It’s an episode from New York’s past that highlights an unusual aspect of this campaign season: the deep connections so many of the election’s key characters have to the Big Apple.

Sure, both candidates have made their marks here: Hillary Clinton, running for and serving as Senator from New York, and Donald Trump, growing up in the city, where he also launched his career as a real estate mogul. Both have also based their campaigns out of the city: Clinton from her Brooklyn headquarters and Trump from a midtown tower that bears his name.

Get Breaking News Delivered to Your Inbox

But their surrounding casts are names that have appeared in the city’s daily papers for years, or even decades. Like Chris Christie, whose “Bridgegate” scandal tied up millions of cars as they inched along the roads near and upon the George Washington Bridge.

Or Clinton’s top aide Huma Abedin, whose estranged former New York congressman husband has all too often led local tabloids to her door. And of course Bernie Sanders, who was born and raised in Brooklyn, taking his accent with him to Burlington, Vermont and eventually Washington.

But perhaps no one more embodies the election’s New York ethos than Rudy Giuliani. Second only to Trump himself, who’s been a fixture in local papers since the 1970s, New Yorkers have been following Giuliani’s career for most of his adult life, way back to his time as a hard-charging prosecutor, determined to take on corruption in City Hall.

I spent a long time — months, in fact — tracking down transcripts from Giuliani’s most high-profile political corruption case: the 1986 trial of Stanley Friedman, a local Democratic party boss, former deputy mayor and attorney whose most famous client was Donald Trump.

Ultimately the case files were shipped, four boxes at a time, from an obscure federal storage facility in Kansas City to the National Archives’ office in New York City, where over the course of several weeks, I sorted through thousands of pages of material.

Let’s get this out of the way early: Neither Giuliani nor Trump responded to requests for comment on the case.

Transcripts from the court proceedings are a window into the old adage that politics makes for strange bedfellows. They show Giuliani hammering away at Friedman’s work for Trump, but only after locking down Friedman’s racketeering conviction in a moment that would live on in New York legal lore.

It was Friedman’s second day on the stand, on Nov. 12, 1986, and Giuliani was in the midst of an hours-long attack on Friedman’s scheme to rig a city contract for handheld parking ticket devices. Giuliani, sounding incredulous, asked about a $10,000 payment Friedman had received for making two brief phone calls to city government officials.

Friedman corrected Giuliani.

Actually, the $10,000 was for making just one call.

“The trial might as well have ended there,” reporter Michael Powell later wrote for The New York Times.

Giuliani, perhaps recognizing that Friedman’s braggadocio in front of the jury assured his conviction, soon pivoted to bigger game. He began asking questions about Friedman’s famed client, according to the transcripts.

Donald Trump during a 1985 interview with CBS’ 60 Minutes. CBS

A decade earlier, Friedman was New York City’s deputy mayor for intergovernmental affairs when Trump offered to buy from the city the tax-delinquent Commodore Hotel, an old, languishing building next to Grand Central Terminal. Friedman - who was interested in joining the law firm of Roy Cohn, Trump’s high-profile lead attorney - shepherded the hotel deal through nine city regulatory agencies. The project, which benefited from a unique agreement freeing the hotel of $160 million in property taxes over the course of 40 years, would later yield one of the only public audits of a Trump business.

“And you told us during your direct examination, Mr. Friedman, that during the latter part of time that you were deputy mayor, you had meetings with Roy Cohn and talked about joining his law firm; isn’t that correct?” Giuliani asked, according to the transcripts, in which a court reporter erroneously spelled Trump’s name as “Trumble” on multiple occasions.

Friedman replied: “Roy Cohn told me sometime prior to (that), ‘When you leave government, if you are ever interested in coming with my firm, let’s talk, and I’m interested in you;’ words to that effect.”

Minutes later, Giuliani pounced.

“Now, isn’t it a fact that in your last week to 10 days in office, you signed for the very profitable deals with one of Roy Cohn’s major clients, Donald Trump -- multi-million dollar deals? You signed while you were deputy mayor, and you were going to his law firm a couple of days, if not a week later?”

Friedman, who became a partner with a top-floor office in Cohn’s Upper East Side firm, said Giuliani was “partially correct,” noting that “Donald Trump has 20 lawyers, maybe, on any one occasion.”

Giuliani kept hammering away at Friedman’s relationship with Trump.

“Mr. Friedman, on Dec. 21, 1977, just a few days before you left office, you signed an escrow agreement, did you not?” Giuliani asked, referring to one of the contracts needed to complete the Commodore Hotel deal.

“If you have it, then I signed it,” Friedman said.

“And that escrow agreement was signed because Mr. Trump was unsure of whether he could get financing before Dec. 31; isn’t that a fact?”

“.…if that’s what you represent as fact, that I signed an escrow agreement on a certain date, I accept that.”

Later, Giuliani asked about a contract signed with Trump on Dec. 29, 1977, just two days before the end of Friedman’s term as deputy mayor.

“And at the time, you knew that Donald Trump was a client of Roy Cohn. … You knew he was a client of the law firm that you were about to join, a couple of days later?”

“Yes, I did.”

Two weeks after Friedman was questioned by Giuliani, a jury found him and three co-defendants guilty on charges including racketeering, conspiracy and mail fraud. Friedman received the stiffest sentence, 12 years in prison, but got paroled after four years. Disbarred, he later managed hotels in Staten Island and Miami.

Throughout the trial, Friedman, a dapper, cigar-chomping figure of a bygone era, wavered from combative — saying in interviews that Giuliani was targeting him to make a name for himself before a planned mayoral run — to mournful for a seemingly changing political system. He said he played by the rules all his life, but suddenly “they changed the rules in the middle of the game.’’

I got a crash course in that game, machine politics, in my first gig out of college, working for a small community paper in the Bronx.

It’s an open secret in counties and cities throughout the country that local parties are often controlled by small groups of powerful people, some elected and some not. Want to seek office or get a project through various approval committees? Better figure out how to get the bosses of your local controlling party on board.

Giuliani made his name in the 1980s taking on that political power class before running for mayor in 1992. While it may seem odd that he’d later partner with Trump, whose legal team once included a party boss and who now brags about his ability to work the system, New Yorkers might find some similarities between Trump’s current platform and Giuliani’s original appeal to voters.

Giuliani was swept into City Hall on the wave of a “law and order” campaign that promised to continue his shake up of the ruling political players, while empowering a beleaguered police force. Sound familiar?

His campaign events were fiery and his supporters fierce. After one speech — at a gathering of police officers protesting a civilian oversight board, a separate commission to investigate police corruption, and Mayor David Dinkins’ sympathy for the family of a Dominican immigrant killed by police — the officers rioted. As thousands of off-duty cops shut down the Brooklyn Bridge, stopping traffic and in a few instances stomping on cars, the on-duty ones warned reporters and others nearby that they should be prepared to protect themselves without help from uniformed patrolmen.

Friedman, reached by phone recently, was willing to chat about Giuliani, but not so much Trump.

“Everyone wants to know about ‘The Donald,’ but I’m trying not to talk about it,” Friedman said. “I’m watching the campaign for entertainment.”

Friedman, 80, said he had been thinking about Giuliani’s 1992 campaign while watching the former mayor on weekend talk shows throughout the campaign, repeating Trump’s arguments about immigration, election-rigging, high crime and other “law and order” issues.

“He’s appealing to the same constituency now as he was then. Doesn’t it seem that way to you?” Friedman said, before pulling back a bit. “But maybe you should get somebody else to talk about this, someone who’s a more credible source than me.”