The decision by Mike Pence to end his presidential campaign on Saturday was a bow to what had finally become inevitable. He was struggling to raise money, win support from the party’s base and manage the torments from the man who had made him nationally famous, Donald J. Trump.

But the root of his campaign’s collapse — and, very possibly, his political career — goes back to 2016, when Mr. Pence accepted Mr. Trump’s offer to be his running mate.

“He got it completely wrong,” said the Rev. Rob Schenck, an evangelical clergyman and a one-time leader of the anti-abortion movement who gave ministerial counsel to Mr. Pence 20 years ago but later turned against him because of his affiliation with Mr. Trump. “This ended up being disastrous for his political career.”

The two men were not close before Mr. Trump’s decision to put Mr. Pence on the ticket. In many ways, beyond sharing a party affiliation, they could not have been more different.

Mr. Pence was the governor of Indiana, an evangelical Christian — he titled his memoir “So Help Me God” — who grew up in the rolling farmland of Indiana. He had endorsed one of Mr. Trump’s primary opponents, Senator Ted Cruz of Texas. And he was, friends said, discomfited by the freewheeling ways of Mr. Trump, a Queens-born playboy entrepreneur and casino owner who had thrived in the Democratic world of New York.

But Mr. Pence was facing a challenging re-election campaign against a Democrat he had only narrowly defeated in 2012. He was, his advisers said, also drawn into the presidential race by the prospect of a spot on the national stage, positioning himself to be either vice president or a strong candidate for president in 2020 should Mr. Trump lose to Hillary Clinton, the Democrat, which polling suggested was likely.

After a few days of consideration — and speaking to his wife, Karen, consulting political advisers and friends, and spending time in prayer, by his account — Mr. Pence accepted Mr. Trump’s offer.

It was a deal that, by Saturday morning in Las Vegas, as a former vice president was forced to exit the race for president without even making it to the Iowa caucuses, Mr. Pence had almost surely come to regret.

He had never learned to manage his relationship with Mr. Trump, to navigate the deep cultural and personal differences between a taciturn Midwestern governor and a flashy New Yorker who never played by the rules of politics that had governed Mr. Pence’s career.

After more than a decade in Congress, one term as governor and another as vice president, Mr. Pence, 64, is, by every appearance, entering the bleakest period of his public life since being elected to Congress from the Second District of Indiana in 2001.

His decision to break with Mr. Trump after the Jan. 6 incursion at the Capitol and his challenge to his former boss for the nomination in 2024 angered the former president and alienated the Trump supporters who define the party today. But Mr. Pence’s four years of loyalty to Mr. Trump while he was vice president ultimately made it impossible for him to to win over voters eager to turn the page on the Trump presidency.

His decision to align himself with Mr. Trump came in June 2016, when a mutual associate of the two men, an Indiana insurance industry executive named Steve Hilbert, called Mr. Pence to see if he would consider an offer to join Mr. Trump. Mr. Pence, who was in the middle of an effort to recover from a potentially ruinous misstep he had made the year before, was open to the idea.

Mr. Pence had signed the Religious Freedom Restoration Act, which effectively authorized businesses to discriminate against gay and lesbian couples, such as Christian businesses that did not want to cater same-sex wedding celebrations. It set off a storm of protest, prompting threats of boycotts from business leaders and sports teams across the nation. The outcry caught Mr. Pence by surprise and put his political future in doubt.

“Even our critics — who said we should have seen it coming — they didn’t see it coming,” said Jim Atterholt, who was then Mr. Pence’s chief of staff. “In fairness to the governor, this was not on his agenda, he was not pushing for it. But obviously, it was consistent with the governor’s philosophy in terms of protecting religious freedom.”

Mr. Pence spent much of the next year talking about state issues like education and taxes, traversing Indiana on what he described as a listening tour as he sought to put the religious freedom bill behind him and turn to his re-election campaign.

“Mike was a wounded incumbent,” said Tim Phillips, a conservative activist who was a close friend and an adviser to Mr. Pence. “I think he would have won that race, if it was a good presidential cycle. But it wasn’t like he was cruising to an easy re-elect and a future presidential run in 2020.”

If Mr. Pence had any qualms when Mr. Trump approached him, he never voiced them publicly or even to many of his advisers. “Mike sent a message saying ‘If I’m being called to serve, I will serve,’” Mr. Atterholt said. “Mike was open to serving, but he was fully planning for the re-election.”

And there were other reasons the offer was tempting. Mr. Pence had never made any secret of his ambitions to run for president himself one day, having given it serious consideration that year. Win or lose, a campaign with Mr. Trump would put him near the front of the line — or so he thought. And Republicans who were concerned about Mr. Trump, and in particular the attention he would pay as president to the evangelical issues that animated Mr. Pence, urged him to do it.

“There was a genuine significant role that the V.P. needed to play for Trump,” Mr. Phillips said. “The evangelical right and the conservatives right were very uneasy with Trump. Having a Sherpa who could guide him and provide credibility with Trump, that really mattered in 2016.”

Today, nearly eight years later, after having served as Mr. Trump’s vice president before turning against him, Mr. Pence’s short-lived campaign stands as testimony to the unexpected consequences of that decision. For all the kind words said about him by his opponents after he dropped out — “I have no doubt Mike and Karen will continue to serve this nation and honor the Lord in all they do,” said one of his former rivals, Tim Scott — his own future is now uncertain.

Mr. Schenck said that he had always been disappointed that Mr. Pence, a man with whom, by his account, he had prayed and read the Scriptures, had aligned himself with a man whom Mr. Schenck called the “diametrical opposite” of the moral leader he and Mr. Pence used to talk about.

“There must have come a point where Mike either thought, ‘I can get the better of Donald Trump or I can rise above his immorality,’” Mr. Schenck said. “He has had to do too much accommodation and adjustment. It might have been fatal to his leadership.”