Just five years ago, Wael Hana was reeling from a string of bad business deals in New Jersey, having tried to launch a truck stop, an Italian restaurant, a limousine service and other companies without ever hitting it big.

Then, his friend started dating Senator Robert Menendez of New Jersey, one of the most powerful Democrats in the United States Senate. Soon, Mr. Hana introduced Mr. Menendez, the chairman of the Senate Foreign Relations Committee, to a growing circle of Egyptian officials, and Mr. Hana’s fortunes took a remarkable turn: He won sole control over certifying all halal food being imported into Egypt, earning enough money to bribe Mr. Menendez with gold bars and wads of cash, prosecutors said.

Mr. Hana, Mr. Menendez and others are now facing charges in what prosecutors have described as a wide-ranging corruption scheme — one that threatens to put an end to the senator’s five decades in politics. But the allegations, if true, also raise a pressing question about Mr. Hana: Was he an agent of the Egyptian government all along, or just a lucky opportunist who stumbled into a position of international influence?

The F.B.I. is investigating this very question. But a New York Times examination of hundreds of pages of court filings, business records and interviews with nearly a dozen people who knew or dealt with Mr. Hana offered insights into the path he traveled during his bumpy start — and meteoric rise.

Within the span of a few years, he would transform from a debt-laden businessman who could not afford even a $2,000 emergency room bill to an international power broker who boasted about his Rolex watch collection to a diplomat in Cairo.

In addition to the corruption investigation into Mr. Menendez, the F.B.I. has been conducting a parallel counterintelligence inquiry, according to four people familiar with the matter, who spoke on condition of anonymity to discuss an active investigation. The review, first reported by NBC News, is seeking to determine whether Egypt’s intelligence service sought to obtain information from Mr. Menendez through Mr. Hana’s friend Nadine Menendez, who married Mr. Menendez in 2020.

Federal agents are also seeking to determine Mr. Hana’s relationship with Egyptian intelligence agencies and when that relationship may have started, two people with knowledge of the matter said.

A spokeswoman for Mr. Hana said in a statement that he was innocent of all charges and that he has cooperated with federal prosecutors by providing them “unfettered access to documents and to his employees.” She added that he voluntarily booked a flight to New York from Egypt “within minutes of learning about this indictment,” leaving his wife and three young daughters behind.

“Wael Hana’s background is a classic immigrant story,” the spokeswoman said. “He has been an entrepreneur who has built several businesses, and he has always acted ethically and legally.”

Mr. Hana, an American citizen, has been on law enforcement’s radar for at least four years. In November 2019, the F.B.I. raided his home and office in New Jersey with a search warrant indicating prosecutors were gathering evidence of potential crimes, including illegally acting as an agent of a foreign government, according to a court filing.

However, Mr. Hana, 40, was not charged with that offense. In the indictment unsealed this September, prosecutors said he was the broker who helped to orchestrate an agreement for Mr. Menendez to steer more American aid and weapons to Egypt. Mr. Menendez is also accused of sending sensitive information about U.S. Embassy employees in Cairo to his wife, who forwarded it to Mr. Hana, who sent it on to an Egyptian government official.

In return, prosecutors said, Mr. Hana and his circle of business associates showered the Menendezes with hundreds of thousands of dollars in cash and gold bars, and bribes that included a mortgage payment for Ms. Menendez, a “low-or-no-show” job for her at Mr. Hana’s halal company and a new Mercedes-Benz convertible.

Mr. Hana, the Menendezes and the others charged in the case have pleaded not guilty. Last week, Mr. Menendez rebuffed calls for his resignation and predicted he would be exonerated.

In August, a month before their arrest, Mr. Menendez and his wife traveled to Egypt, where the senator met with President Abdel Fattah el-Sisi, according to two people with knowledge of the matter.

The Egyptian government has not commented publicly. On YouTube, some pro-government influencers praised the facts of the investigation, saying that it showed how Egypt was doing a good job of protecting its own interests.

Mr. Hana was 22 when he arrived in the United States through the visa lottery system in 2006, a few years after the death of his father, according to a person familiar with Mr. Hana’s background. He started working for a cleaning company and enrolled in English language classes at a community college, the person said.

Right away, he showed an entrepreneurial hustle, creating a trucking business called Elmanhry LLC — the first in a long list of businesses that would appear under his name.

He bought a home in Bayonne, N.J., for $450,000 from a seller who attended the same Egyptian church as he did, the seller said. He appeared to buy the home without a down payment, securing a mortgage for the full purchase price, property records show.

By 2011, Mr. Hana had moved on to the luxury car business, and he approached a Chinese businessman with a proposal. Mr. Hana would negotiate with Porsche and Mercedes-Benz dealerships in New Jersey to purchase new cars on behalf of the businessman, who would then sell them to customers in China. They hashed out the details over dinner at a seafood restaurant in Flushing, Queens, according to court records.

But after the businessman’s company, Bosto New York, wired $3.6 million to Mr. Hana and his partners, they provided only $2.9 million worth of cars, the businessman said in a lawsuit filed in 2012.

Bosto New York won a judgment against Mr. Hana and his partners for the missing $705,000, but Mr. Hana never appeared in court or paid off what he owed, records show.

Soon, Mr. Hana’s legal troubles began to snowball. He was accused in lawsuits of writing bad checks, among other things, eventually racking up a total of at least $890,000 in judgments, court records show.

In 2014, Mr. Hana was charged with driving while intoxicated after police officers said they found him passed out in the driver’s seat of a parked car in Oradell, N.J. When Mr. Hana was taken to the hospital, the police said he threatened them several times, according to a local police blotter.

The lawyer who represented him in court, Andy Aslanian, would eventually introduce Mr. Hana to the tangled web of friends and business associates that would give rise to the indictment against Mr. Menendez.

In interviews, Mr. Aslanian said he took Mr. Hana under his wing after learning that Mr. Hana was alone in the country. At one point, Mr. Aslanian shared his office space with him, and they spent some holiday dinners together.

“I considered him my No. 1 son,” Mr. Aslanian said of Mr. Hana.

At that time, Mr. Aslanian had cause for concern. A hospital had sued Mr. Hana in 2017 for thousands of dollars in unpaid medical bills. And he had missed years of mortgage payments and taxes, according to court records, ultimately resulting in the loss of his Bayonne home to foreclosure in 2018.

Although he struggled financially in the United States, Mr. Hana appeared to have a close tie with the government in Egypt.

He recommended Mr. Aslanian for a job representing Egypt in a 2016 zoning dispute over a building — intended as a residence for Egyptian military representatives and their families — in East Rutherford, N.J., Mr. Aslanian told The Record, a newspaper in Bergen County.

Mr. Aslanian, who met Mr. Hana around 2009 and introduced him to the future Ms. Menendez, Nadine Arslanian, soon after, also made other connections for Mr. Hana. Mr. Aslanian said the three of them would often hang out after work at a French restaurant owned by the developer Fred Daibes — who would also be charged in the corruption case alongside Mr. Hana and the Menendezes.

In November 2017, Mr. Aslanian and Mr. Hana created a company called IS EG Halal, whose purpose was to certify meat as halal, or prepared in adherence with Islamic law. Mr. Daibes would lend financial backing to the project.

Three months later, according to the indictment, their friend Nadine began dating Mr. Menendez.

Douglas Anton first met Mr. Hana in 2017 through Ms. Menendez, who was dating Mr. Anton at the time. She introduced Mr. Hana as someone who was a relative of “somebody high up in the Egyptian government,” Mr. Anton recalled.

Mr. Anton was never quite sure what Mr. Hana did for work, other than that “he was some kind of liaison with Egypt,” Mr. Anton said.

Behind the scenes, according to prosecutors, Mr. Hana was texting directly with Egyptian military and government officials. Throughout 2018, Mr. Hana was busy setting up meetings to introduce them to Mr. Menendez. The senator began to use his position to benefit Egypt’s interests, the indictment said, including by ghostwriting a letter for an Egyptian official who was trying to persuade other U.S. senators to release a hold on $300 million in military aid to Egypt.

Mr. Hana’s efforts came as Egyptian officials were aggressively lobbying members of Congress to lift restrictions on the aid, which lawmakers imposed in response to the government’s poor human rights record. Officials in Cairo viewed the restrictions as an affront to a nation that has been a partner to the United States on counterterrorism, trade and regional security for years.

Mr. Hana’s connections paid off handsomely in the spring of 2019.

The Egyptian government abruptly awarded his company, IS EG Halal, the exclusive right to certify all American food imported into Egypt as halal, prosecutors said.

The decision caused concern throughout the industry. Mr. Hana, a Christian, had no experience in halal certification. By his own admission, the company was not even operating until it was awarded the monopoly.

In a court filing in 2020, Mr. Hana explained that he won the approval because the Egyptian government wanted to take any halal certification power away from the Muslim Brotherhood, an Islamist movement that Egypt has vilified as a terrorist group, to deprive it of financial resources.

Because he had no expertise in Islamic law, Mr. Hana wrote, the Egyptian government provided him with imams and veterinarians to train him.

Before securing the monopoly, Mr. Hana wrote, he had another company that was already shipping goods into Egypt on the government’s behalf, taking bid requests from the Egyptian Ministry of Defense’s office in Washington. Mr. Hana said he was also in the process of starting another company that would handle the shipping of everything sold by the U.S. Army to Egypt.

Mr. Menendez would later be accused by prosecutors of calling a high-level official in the U.S. Department of Agriculture to stop the U.S.D.A. from interfering with Mr. Hana’s import business, which had raised prices for meat suppliers worldwide. Previously, the certification in the United States had been performed by a handful of companies.

Prosecutors allege that the senator was motivated to help Mr. Hana because Mr. Hana was using his halal company to wire bribe money to Ms. Menendez.

After the monopoly, Mr. Hana was living large. The company was headquartered in Edgewater, N.J., down the street from Mr. Hana’s new luxury apartment overlooking the Hudson River, in a building owned by the family of Mr. Daibes.

The man who had just lost his home to foreclosure now had enough money to help his friends with their mortgages. In July 2019, prosecutors said, Mr. Hana used his halal company to pay about $23,000 to bring Ms. Menendez current on her mortgage during her own foreclosure proceedings.

But soon, an F.B.I. raid threatened to torpedo it all. In November 2019, federal agents searched Mr. Hana’s home and office, seizing electronic devices, papers, notepads, a photo album and even a gold cigarette.

During the search, federal agents questioned Mr. Hana about contacts he had in Egypt, including with an embassy employee, Mr. Hana said in a court filing. He said his entire family lived in Egypt.

Federal agents also discovered that Mr. Hana’s cellphone contained thousands of text messages with Ms. Menendez, prosecutors later said.

After a few months, with no criminal charges in sight, Mr. Hana asked the prosecutors to return his belongings. Among the seized items were a chain he bought in Italy, two Rolex watches that he said were gifts and a pair of earrings he said he designed for his mother that were worth about $15,000.

“I do not understand why the government would take my jewelry, which I would like to wear,” he wrote in a court filing. It was unclear whether he got his jewelry back.

By 2020, federal officials said Mr. Hana’s halal company had essentially become an Egyptian state entity, winning an expanded monopoly to control the certification process for all food and beverages shipped to Egypt from anywhere in the world.

As his business prospered, prosecutors said, Mr. Hana made time to ensure that Ms. Menendez was placated. In June 2021, he bought 22 gold bars with unique serial numbers, valued at a total of about $40,000, according to prosecutors. Two of the gold bars were later found in the Menendez home by federal agents, prosecutors said.

The rapid expansion of his business led Mr. Hana to travel frequently, opening offices in Uruguay, India, Brazil, Egypt and New Zealand. Photos posted on the internet show him meeting with ambassadors and dignitaries around the world to discuss trade with Egypt.

Last year, Mr. Hana made a memorable impression on one former Western diplomat in Cairo. The diplomat, who spoke on the condition of anonymity, said Mr. Hana was an hour late to their lunch with no explanation or apology. They discussed the halal certification process, and Mr. Hana mentioned countries that were complaining about the prices he was charging.

The diplomat thought Mr. Hana was such a character that he wrote about it in his diary: He was “wearing an absurdly expensive suit, gold Rolex, gold rings. Spoke confidently, but softly, so you had to really listen.”

“In our second lunch,” he added, “he spent about twenty minutes telling me about his Rolex collection.”

After he was indicted, it was a decidedly less flashy Mr. Hana who appeared before a judge in Federal District Court in Manhattan this past week, dressed in a baggy blue shirt and slacks.

He was released the same day after securing a $5 million bond — and agreeing to wear a GPS monitoring device.

Vivian Yee, Julian Barnes, Adam Goldman and Mark Mazzetti contributed reporting. Kirsten Noyes contributed research.