Robert Menendez’s education in political corruption came unusually early. In 1982, he turned against his mentor, Mayor William V. Musto of Union City, N.J., the popular leader of their gritty hometown.

Mr. Menendez took the witness stand and testified that city officials had pocketed kickbacks on construction projects, helping to put a man many considered his father figure behind bars. Mr. Menendez, then 28, wore a bulletproof vest for a month.

The episode, which Mr. Menendez has used to cast himself as a gutsy Democratic reformer, helped fuel his remarkable rise from a Jersey tenement to the pinnacles of power in Washington as the state’s senior senator. The son of Cuban immigrants, Mr. Menendez broke barriers for Latinos and has used his perch as chairman of the Senate Foreign Relations Committee to influence presidents and prime ministers.

But those who have closely followed his career say the years he spent enmeshed in Mr. Musto’s machine also set the tone for another, more sinister undercurrent that now threatens to swallow it — one in which Mr. Menendez became a power broker himself whose own close ties to monied interests have repeatedly attracted the scrutiny of federal prosecutors.

Those two sides of his life are set to collide on Wednesday in federal court in Manhattan, where Mr. Menendez, 69, is expected to surrender to face his second bribery indictment in less than a decade.

The explosive charges, unveiled on Friday, accuse the senator and his wife of taking hundreds of thousands of dollars in bribes in exchange for helping increase U.S. assistance to Egypt and trying to throttle a pair of criminal investigations involving New Jersey businessmen. Investigators who searched their suburban home found piles of cash squirreled away, gold bars worth $100,000 and what they described as an ill-gotten Mercedes-Benz.

Mr. Menendez insists he is innocent and refuses to resign. He has already begun accusing the government of twisting facts to try to criminalize legitimate congressional activity — the same defense that helped him bottle up the last charges in a hung jury.

But interviews with nearly two dozen New Jersey political figures who worked with, watched and fought him, as well as a review of court records stretching back two decades, paint a far more complicated portrait of a man who has been both a pathbreaking legislator of unusual intelligence, and a vindictive politician with a propensity for accepting lavish gifts he could never have afforded on a government salary.

As a measure of how damning the indictment appears, no one — not even a longtime ally recommended by Mr. Menendez’s office — agreed to publicly defend him on the conduct described by prosecutors.

“What we are witnessing is a pattern that developed early and just spun out of control,” said Robert Torricelli, a former Democratic senator from New Jersey who served alongside Mr. Menendez in Washington. “People don’t often change. In a lot of ways, Bob Menendez is still a Union City commissioner in the late 1970s.”

The pervasiveness of corruption in Hudson County, N.J., a dense expanse of blue-collar cities just across the Hudson River from New York City, extends well beyond the 1970s. From Bayonne to North Bergen, mayors, a county executive, state lawmakers and council members alike have gone down on corruption charges.

No one seemed to learn a lesson, especially in Union City: Mr. Musto’s immediate successor, Robert C. Botti, was indicted seven weeks after taking office, and received an 18-month prison sentence.

As corruption charges rained down around him, Mr. Menendez prospered, becoming a master of the kind of back-room deal-making that was dying out in other parts of the country as he rose through elected offices.

Prosecutors have spent the better part of 18 years, the length of Mr. Menendez’s Senate tenure, looking into the blurry lines between his office and special interests. That dubious investigative distinction is approached by no other modern senator.

Many of the suspicions that attracted their attention never amounted to charges, but other facts still raised concerns. He accepted rides on private planes, luxurious vacations, and other perks from wealthy friends at the same time he freely used his office to advance their interests. All that earned him a stern rebuke by the bipartisan Senate Ethics Committee in 2018. He helped advance the careers of longtime friends and love interests who remained loyal. And when they crossed him, he did not hesitate to use a deep Rolodex to exact payback.

Mr. Torricelli, who retired amid his own ethics scandal, said he harbored concerns about the senator for years. Yet like other Democrats, he looked the other way, willing to move past suspicions out of personal loyalty, disbelief or appreciation for the liberal political policies Mr. Menendez championed in Congress, from immigration reform to abortion rights.

In recent years, that vacuum allowed the senator to continue burnishing his legacy, even amid a drumbeat of damaging leaks about the latest investigation. His daughter, Alicia Menendez, secured her own weekend show on MSNBC. He helped his son, Robert Menendez Jr., win his old House seat in 2022. And he had taken steps toward running for a fourth term.

Now, after 49 years in public life, all of it is at risk of disintegrating.

“This will be the biggest fight yet,” Mr. Menendez said at a news conference in Union City earlier this week, as he dug in his heels. “Remember, prosecutors get it wrong sometimes. Sadly, I know that.”

Even for the Senate, filled with high achievers and fast climbers, Mr. Menendez had trained his sights on elected office from an uncommonly young age. He won his first, a seat on the Union City school board, at just 20 after he was told in high school he would have to pay for his own books if he wanted to take honors classes.

A dense knot of factories and inexpensive housing, Union City had long been a magnet for immigrants, and at the time Mr. Menendez was coming of age, refugees fleeing the Cuban Revolution were remaking it into a little Havana. His own parents, a seamstress and carpenter, had come earlier.

But for Mr. Menendez, the timing was just right. The region’s fast-growing Latino population provided the bilingual Democrat a reliable base — sometimes delivering him 75 percent or more of the vote — to fuel a steady ascent.

Mr. Menendez’s election to the school board put him in touch with Mr. Musto, who hired him as an aide while he finished college and law school. He would eventually break with Mr. Musto, testifying at trial and running against him in 1982; Mr. Musto somehow prevailed in that election, held just after he was sentenced to prison. Four years later, Mr. Menendez was elected mayor, and seats in the Assembly, State Senate and then Congress, in 1993, soon followed.

In Washington, he thrived in the halls of the clubby Senate. He serenaded colleagues and longtime supporters on their birthdays in a high baritone and quickly mastered the delicate levers that could hold up nominations and torpedo bills until his priorities were included.

At night, he could often be found at Morton’s steakhouse near the White House, where he billed his campaign accounts $16,000 a year, on average, The New York Post once wrote, enjoying a cigar on the balcony.

With money from Washington, Mr. Menendez is credited with helping realize a light-rail network in Hudson County that moves tens of thousands of people a day, securing billions of dollars in federal aid to rebuild after Hurricane Sandy ravaged the state in 2012, and more recently, shouldering forward a new rail tunnel beneath the Hudson, the largest public works project in the nation.

He frequently clashed with presidents in his own party on foreign policy. He sharply criticized the Biden administration’s withdrawal from Afghanistan in 2021, fought President Barack Obama’s nuclear deal with Iran, and became a one-man wrecking ball in an attempt to stop Mr. Obama from normalizing relations with Cuba.

“Bob labored intensely to master detail,” said James E. McGreevey, a former New Jersey governor who resigned two decades ago in scandal. “He relished both the subject matter and the process, and typically had among the strongest commands.”

But back home, his popularity was also enforced by fear.

“In the beginning yeah, we used to bust each other’s balls — had a lot of fun with him,” said Richard J. Codey, another former governor and longtime state legislator. “As time passed, he started to become more of a boss than a politician.”

In 1999, when he was in Congress, Mr. Menendez effectively ousted a former protégé, Rudy Garcia, as mayor of Union City after Mr. Garcia fired Donald Scarinci, a lawyer who served as city attorney, and who was the then-congressman’s friend since childhood. Mr. Menendez had come to view Mr. Garcia as a possible political threat.

“Bob resented it, and Rudy refused to become totally his alter-ego, like some others,” said Joseph Doria, a Hudson County Democrat who served as speaker of the assembly. “They had a big war.”

Another fight erupted in 2004, when the mayor of Jersey City recruited Steven Fulop to try to primary Mr. Menendez. Mr. Fulop, an Iraq War veteran and Goldman Sachs analyst in his 20s, had no shot at winning, but the Jersey City mayor wanted to send a message to Mr. Menendez, a political rival.

Mr. Menendez was furious. He called the home phone of the Goldman managing director who was handling government relations around the construction of the bank’s massive new tower in his district in Jersey City at the time. The managing director, who insisted on anonymity to discuss the previously unreported episode, recalled Mr. Menendez’s screams. He said he later called Mr. Menendez back to assure him the bank had been unaware of Mr. Fulop’s campaign.

A spokesman for Mr. Menendez disputed on Tuesday that the call ever happened.

In an interview, Mr. Fulop said he was promptly summoned by the head of Goldman’s human resources department and was told “we don’t run primaries against sitting congressman.” He worried he would lose his job, but did not, and stayed in the race and lost. He is now mayor of Jersey City himself, and is running for governor.

“I don’t think anyone would ever classify Bob Menendez as a beacon of morals and ethics,” said Mr. Fulop, who later reconciled than fell out with Mr. Menendez anew. “That was never how he built his career.”

Mr. Menendez’s ascension to the Senate in 2006 was the culmination of a dream he had harbored since he was a teenager. But no sooner had he moved across the Capitol than federal prosecutors in New Jersey began investigating.

Their interest initially centered on North Hudson Community Action Corporation, a nonprofit that paid Mr. Menendez some $300,000 over nine years in rent at the same time he helped secure the group millions of dollars in federal grants. Prosecutors wanted to know if the payments were market rate.

Mr. Menendez was initially appointed to the Senate to fill the seat vacated by Jon Corzine when he became governor, and was running for a full term that fall when news of a subpoena for the nonprofit leaked. The senator denied any wrongdoing and accused the U.S. attorney for New Jersey, Chris Christie, of political high jinks to help his Republican opponent.

But the investigation opened the door to federal scrutiny that would follow Mr. Menendez almost continually in the Senate, as prosecutors scrutinized suspicious dealings involving a mix of romantic interests, Hudson County developers and new friends with vast resources.

Many of Mr. Menendez’s longtime political allies said they were surprised only by the luridness of the most recent charges, but not the idea that he would accept gifts from wealthier friends. Despite his growing political clout, Mr. Menendez remained one of the poorest members of the Senate — having never officially earned much more than a government paycheck.

“You’re dealing with people around you who need you and want you who are multimillionaires,” Mr. Codey said, adding: “The temptation is too much.”

By 2007, scrutiny fell on his relationship with Kay LiCausi, a former aide almost two decades his junior whom he was widely reported to be dating. (He had divorced his wife, a teacher, in 2005.) After she left his office, Mr. Menendez helped Ms. LiCausi secure lucrative consulting contracts with Democratic groups. She also began working for companies and organizations with ties to the senator who needed his help in Washington. He again denied any misconduct.

An executive for a company trying to develop a billion-dollar mall and entertainment complex in the Meadowlands later testified to a grand jury that he hired Ms. LiCausi to lobby because of her connections to Mr. Menendez. After the senator helped with an Army Corps of Engineers permit for the project, the executive testified, he was asked to raise $50,000 for Mr. Menendez’s campaign, Bloomberg News reported in 2015 based on court documents.

Prosecutors closed the investigation in 2011 without bringing charges. The next year, the senator caused a stir when he objected to the nomination of an appeals court judge whose longtime partner worked on the investigation. He said it was not political, and under pressure from the White House, he eventually relented.

Unharmed by the yearslong saga, Mr. Menendez easily won a second term that fall, rising to the Foreign Relations chairmanship.

But the reprieve would only be short-lived: just days before Mr. Menendez took the gavel, the F.B.I. raided the office of Dr. Salomon Melgen, a Florida eye surgeon who Mr. Menendez counted among his closest friends.

It took two years to bring charges, but in 2015, Mr. Menendez became the first sitting senator in a generation to be charged with federal bribery.

The indictment painted a deeply unsavory portrait of his Senate office, where his chief of staff helped solicit gifts and track what Dr. Melgen needed. Prosecutors said that Mr. Menendez went to great personal lengths, lobbying other high-ranking government officials to help resolve a multimillion Medicare billing dispute and to protect the surgeon’s business interests in the Dominican Republic. The senator also helped his friend’s foreign girlfriends obtain travel visas to the United States, they said.

Dr. Melgen was generous in return, with $700,000 in donations to support the senator’s campaigns and the kind of luxury travel Mr. Menendez could scarcely have imagined as a younger man: rides on a private plane, stays at a Dominican villa and a Paris hotel.

Mr. Menendez’s lawyers did not dispute most of the actions; they cast them not as corruption, but the fruits of a decades-old friendship and the senator’s policy interests. Prosecutors had another unforeseen challenge: Between their indictment and the trial in 2017, the Supreme Court had issued a landmark decision raising the bar the government needed to meet to prove political corruption.

The trial ended in a hung jury just before Thanksgiving 2017. When Mr. Menendez stepped outside of the federal courthouse in Newark, he declared his “resurrection day” — and revenge.

At the time, Democrats played down the seriousness of the charges and largely hung with him, in part because Mr. Christie was governor and could have appointed a fellow Republican to fill a vacant seat. Mr. Menendez limped to re-election in 2018, largely on the strength of the anti-Trump backlash, according to Democrats involved in the party’s races.

“In New Jersey, we have been willing to overlook a lot for people who believe in the same values we do,” said Loretta Weinberg, who served as majority leader of the State Senate.

For Mr. Menendez, the victories papered over a what had been an exceedingly painful period in his life. His fiancée, Alicia Mucci, broke off their engagement on the eve of the bribery trial, years after he proposed in the Capitol Rotunda, she said in a brief interview. He moved out and, as a bachelor once again his 60s, was a regular at Fornos of Spain, just a few blocks from the courthouse.

It was only a few months later, prosecutors say, that Mr. Menendez began dating Nadine Arslanian, the woman who would become his wife and soon introduce him to key figures whose fates are now intertwined with his in court.

Jack Begg and Kitty Bennett contributed research.