Manhattan prosecutors investigating a payout to Stormy Daniels may be poised to make Donald J. Trump the first former president ever to be criminally indicted.At the time, it all was more tawdry than momentous. A reality star invited a porn actress half his age to a hotel room after a round in a celebrity golf tournament. She arrived in a spangly gold dress and strappy heels. He promised to put her on television and then, she says, they slept together.Yet the chain of events flowing from the 2006 encounter that the adult film star, Stormy Daniels, has said she had with the television personality, Donald J. Trump, has led to the brink of a historic development: the first criminal indictment of a former American president.The Manhattan district attorney, Alvin L. Bragg, has signaled he is preparing to seek felony charges against Mr. Trump; Mr. Bragg is expected to accuse him of concealing a $130,000 hush-money payment that Michael D. Cohen, Mr. Trump’s lawyer and fixer, made to Ms. Daniels on the eve of the 2016 presidential election.A conviction would be likely to hinge on prosecutors’ proving that Mr. Trump reimbursed Mr. Cohen and falsified business records when he did so, possibly to hide an election law violation.It would not be a simple case. Prosecutors are expected to use a legal theory that has not been assessed in New York courts, raising the possibility that a judge could throw out or limit the charges. The episode has been examined by both the Federal Election Commission and federal prosecutors in New York; neither took action against Mr. Trump.Mr. Trump has denied having sex with Ms. Daniels and said he did nothing wrong. The former president, who is seeking the Republican nomination for the White House, has made it clear that he will cast the indictment as a political “witch hunt” and use it to rally his supporters. On Saturday, he predicted he would be arrested on Tuesday and called for protests.The prosecutors’ chief witness would be Mr. Cohen, who pleaded guilty to federal campaign finance violations in August 2018, admitting he helped arrange the Daniels payment — and another to a former Playboy model — to aid Mr. Trump’s presidential bid at the behest of Mr. Trump.Any indictment of Mr. Trump brought by the Manhattan district attorney, Alvin L. Bragg, would rely on a legal theory that has not been tested in New York courts, making its success far from assured.Benjamin Norman for The New York TimesAn indictment would mark another extraordinary episode in the Trump era: The former president — whose tenure closed with a riot at the Capitol, who tried to overturn a fair election and who is under investigation for failing to return classified material — may face his first criminal charge for paying off a porn star.A Lake Tahoe encounterMs. Daniels, born Stephanie Gregory and raised mostly in a ramshackle ranch house in Baton Rouge, La., was 27 in July 2006, when she met Mr. Trump, then 60, at the celebrity golf tournament in Nevada.As a child, she wrote in her 2018 memoir, “Full Disclosure,” she felt ashamed and motivated after overhearing a friend’s father refer to her as “white trash.” Attracted by the money she could make, Ms. Daniels started as an exotic dancer even before she finished high school, working at a local joint called Cinnamon’s. At 23, she began acting in pornographic movies and soon married the first of her four husbands: Bartholomew Clifford, who directed adult films under the name “Pat Myne.”When he met Ms. Daniels, Mr. Trump had largely transitioned from real estate mogul to reality star; he had traveled to the tournament without his third wife, Melania, who remained behind with their newborn son. Mr. Trump and Ms. Daniels crossed paths on the golf course and later in the gift room, where they were photographed together at a booth for her porn studio, Wicked Pictures. He invited her to dinner.As they chatted that night in Mr. Trump’s penthouse at Harrah’s Lake Tahoe — she has said he wore black silk pajamas and slippers — he told her that she should be on “The Apprentice,” an NBC reality show. She doubted he could make it happen. He assured her he could, she said.Afterward, he would phone her occasionally from a blocked number, calling her “Honeybunch.” They saw each other at least twice more in 2007, at a launch party for the short-lived Trump Vodka and at the Beverly Hills Hotel, where they watched “Shark Week.” But they did not sleep together again. And Mr. Trump never put her on “The Apprentice.” Still, he kept calling, she has said. Eventually, she stopped answering.Selling storiesStormy Daniels, an adult film star, was paid $130,000 by Mr. Trump’s fixer in exchange for her silence.Shannon Stapleton/ReutersSince 2000, Mr. Trump had staged long-shot presidential runs that more resembled publicity stunts than serious bids for office. He kicked off another in 2011, promoting conspiracy theories that then-President Barack Obama had been born outside the United States. As he did so, Ms. Daniels, still bitter, began working with an agent to see if she could sell the story of their liaison.They negotiated a $15,000 deal with Life & Style, a celebrity magazine, telling its reporter that Ms. Daniels believed Mr. Trump’s offer to make her a contestant had been a lie, according to a transcript later published online.“Just to impress you, to try to sleep with you?” the reporter asked. “Yeah,” Ms. Daniels responded. “And I guess it worked.”When the magazine contacted the Trump Organization for comment, Michael Cohen returned the call. A lawyer who had joined the company four years earlier, Mr. Cohen had become Mr. Trump’s fixer, diving headlong into resolving thorny problems for his boss and the Trump family. Mr. Cohen threatened to sue, the magazine killed the story, and Ms. Daniels did not get paid.Mr. Trump, for his part, dropped out of the race and continued hosting “The Apprentice.”That October, Ms. Daniels’s story about Mr. Trump surfaced briefly after her agent leaked it to a gossip blog called “The Dirty,” trying to gin up interest from a paying publication. A couple of media outlets followed up, but none offered payment. Ms. Daniels denied the story, and her agent had a lawyer in Beverly Hills, Calif., Keith Davidson, get the post taken down.As Mr. Obama prepared to leave office in 2015, Mr. Trump decided to run for president once more. That August, he sat in his office at Trump Tower with Mr. Cohen and David Pecker, the publisher of American Media Inc. and its flagship tabloid, The National Enquirer.Mr. Pecker, a longtime friend of Mr. Trump’s, had used The Enquirer to boost Mr. Trump’s past presidential runs. He promised to publish positive stories about Mr. Trump and negative ones about opponents, according to three people familiar with the meeting. Mr. Pecker also agreed to work with Mr. Cohen to find and suppress stories that might damage Mr. Trump’s new efforts, a practice known as “catch and kill.”The National Enquirer, a tabloid run by David Pecker, played a central role in efforts to “catch and kill” negative stories about Mr. Trump.Marion Curtis, via Associated PressIn spring 2016, Ms. Daniels attempted through her agent to sell her story again — this time for more than $200,000. But the publications she approached all passed, including The Enquirer.Around the same time, Karen McDougal, the former Playboy model, began exploring how to monetize her own tale of sleeping with Mr. Trump. Ms. McDougal, Playboy’s 1998 Playmate of the Year, has said she had an affair with Mr. Trump starting in 2006, when she was 35. They had spent time together in his Trump Tower apartment and at the same golf tournament where Ms. Daniels encountered him. But Ms. McDougal ended the relationship in 2007, she has said. Mr. Trump has denied the affair.In 2016, with her modeling career flagging, Ms. McDougal hired Mr. Davidson, the same lawyer who had helped Stormy Daniels remove the 2011 blog post.Karen McDougal, a former Playboy model, said she also had an affair with Mr. Trump and was paid by The National Enquirer for her story, which was never published.Bennett Raglin/Getty Images for BacardiThe lawyer approached The Enquirer’s editor, Dylan Howard, about buying Ms. McDougal’s story, and Mr. Howard and Mr. Pecker both briefed Mr. Cohen, three people with knowledge of the discussions have said. In late June, Mr. Trump personally appealed to Mr. Pecker for help in keeping Ms. McDougal quiet, according to an account Mr. Pecker gave federal prosecutors.But the tabloid did nothing until Ms. McDougal was about to give an interview to ABC News. In early August, American Media agreed to pay Ms. McDougal $150,000 for the exclusive rights to her story about Mr. Trump, camouflaging the real purpose of the deal by guaranteeing she would appear on two magazine covers, among other things, five people familiar with the events have said.American Media would later admit, in a deal to avoid federal prosecution, that the principal purpose of the agreement was to suppress Ms. McDougal’s story, which the company had no intention of publishing.Stormy Daniels, meanwhile, still had not found any takers for her story. Her luck changed in early October.‘It could look awfully bad’Mr. Trump’s fixer, Michael D. Cohen, right, went to prison in part for campaign finance violations related to hush-money payments. He has turned against the former president and could testify against him.Jefferson Siegel for The New York TimesThe news hit the presidential race like a bomb. On Oct. 7, 2016, The Washington Post published what would become known as the “Access Hollywood” tape, in which Mr. Trump, unwittingly on a live microphone, was recorded describing in lewd terms how he groped women.The people surrounding Stormy Daniels immediately realized that Mr. Trump’s new vulnerability made her more of a threat — and thus gave her story value.Mr. Davidson, the Los Angeles lawyer, was also friendly with Ms. Daniels’s agent, Gina Rodriguez, and with The Enquirer’s editor, Mr. Howard. On the day after the “Access Hollywood” tape emerged, Mr. Davidson and Mr. Howard texted about the damage it had done to Mr. Trump’s campaign. Then Mr. Howard asked Ms. Daniels’s agent to send another pitch for his boss, Mr. Pecker.The Enquirer executives alerted Mr. Cohen; Mr. Cohen asked Mr. Pecker for help containing it.Mr. Howard haggled with Ms. Daniels’s agent, but when he presented Mr. Pecker with an offer to buy the story for $120,000, the publisher refused.“Perhaps I call Michael and advise him and he can take it from there,” Mr. Howard wrote.Dylan Howard, the editor of The National Enquirer, connected Mr. Cohen to a lawyer for Ms. Daniels to discuss a payment for the story of her tryst with Mr. Trump.Ilya S. Savenok/Getty Images for American MediaThat night, Mr. Cohen spoke by phone to Mr. Trump, Mr. Pecker and Mr. Howard, according to records obtained by federal authorities. Mr. Howard connected him to the lawyer, Mr. Davidson, who would negotiate the deal for Ms. Daniels.Three days after the “Access Hollywood” tape’s release, Mr. Cohen agreed to pay $130,000 in a deal that threatened severe financial penalties for Ms. Daniels if she ever spoke about her affair with Mr. Trump. The contract used pseudonyms: Peggy Peterson, or “P.P.,” for Ms. Daniels, and David Dennison, or “D.D.,” for Mr. Trump. Their identities were revealed only in a side letter.Ms. Daniels signed her copy on the trunk of a car near a porn set in Calabasas, Calif. Mr. Cohen signed on Mr. Trump’s behalf.But Mr. Cohen delayed paying. He has said he was trying to figure out where to get the money while Mr. Trump campaigned. According to Mr. Cohen, Mr. Trump had approved the payment and delegated to him and the Trump Organization’s chief financial officer the task of arranging it. They considered options for funneling the money through the company, Mr. Cohen said, but did not settle on a solution.Ms. Daniels began to believe that Mr. Trump was trying to stall until after the Nov. 8 election; if he lost, her story would lose its value. In mid October, after Mr. Cohen had blown two deadlines, Ms. Daniels’s lawyer canceled the deal, and the porn actress again began shopping the story. The next week, Mr. Howard texted Mr. Cohen that if Ms. Daniels went public, their work to cover up the sexual encounter might also become known.“It could look awfully bad for everyone,” Mr. Howard wrote.Mr. Cohen agreed to make the payment himself. He spoke briefly by phone with Mr. Trump, twice. Then he transferred about $130,000 from his home equity line of credit into the account of a Delaware shell company and wired it to Ms. Daniels’s lawyer.Mr. Davidson circulated a new hush-money agreement. Ms. Daniels signed and notarized it at a UPS store near a Walmart Supercenter in Forney, Texas, near her home.“I hope we are good,” Mr. Cohen texted Mr. Davidson afterward.“I assure you we are very good,” the lawyer replied.Ms. Daniels remained silent. A week and a half later, Mr. Trump won the election.Once he was in the White House, Mr. Trump handled one more piece of business related to Stormy Daniels. He signed checks to reimburse Mr. Cohen for paying her off.Jonah E. Bromwich More