For my entire adult life I have listened to the invective leveled against the Republican Party by liberals: It is a party sustained by racist appeals, composed of haters and conspiracy nuts, indifferent to the plight of the poor and the weak, anti-woman.

I have repeatedly denied those charges, publicly and forcefully. The broad indictment, the unfair generalizations, were caricature and calumny, the product of the fevered imagination of the left. Then along came Donald J. Trump, who seemed to embody every awful charge made against the Republican Party.

Later this week he will become my party’s nominee.

For many of us lifelong Republicans, the convention in Cleveland will be a time of serious self-reflection, a difficult and honest reckoning. Those of us who have chosen not to attend the convention will have a bit more time on our hands to think it over. How on earth did our party produce Mr. Trump as its nominee?

There’s a powerful temptation for many Republicans to avoid that question — or, in wrestling with it, to look to reassuring explanations and extenuating circumstances. For example, Mr. Trump benefited from an unusually large field of candidates by consolidating support among a small but significant number of Republican primary voters while the rest split their support among the fractured field. Or: Mr. Trump profited from a huge imbalance in free media, earning close to $2 billion worth of it during the presidential campaign, eclipsing, according to one analysis, the total value of media attention given to all other Republican candidates combined.

There are other explanations as well, and they may all have merit. But there is still the unalterable fact that Mr. Trump led for virtually the entire contest and defined its terms from the outset. At every stage — with every racist statement and nativist appeal, every cruel insult, every new conspiracy theory and fresh revelation of his vast ignorance — he grew stronger rather than weaker. The ceiling we kept hearing about last summer and fall, starting at the high teens and low 20s, kept rising. The candidates who were supposed to vanquish him — many of them talented and accomplished individuals — kept dropping out.

Mr. Trump’s comeuppance never came.

He ended up winning 36 contests and more Republican primary votes than anyone in history. That means people like me — in my particular case, someone who all told served a decade in the Ronald Reagan and George H. W. Bush administrations and in the George W. Bush White House — are not only alienated from our political home and isolated in our party; we are in open revolt against its nominee. That says something about Mr. Trump, but it also tells us something about the party he now leads.

For many on the left, explaining what happened is simple: The Republican Party has always been this way, and Mr. Trump is the logical and inevitable culmination of what the Republican Party has represented for decades. He is the ugly face of an ugly party.

I believe the truth is a good deal more complicated. For one thing, the rise of Mr. Trump doesn’t invalidate my own experiences of life in a party comprising mostly honorable individuals working to advance an agenda they believed was in the national interest. I understand this will elicit a roll of the eyes in an age when cynicism is fashionable, but it happens to be true. Both parties are made up of imperfect people who have very different worldviews yet who by and large are acting in what they believe is the public interest. The idea that one side comprises Children of Light and the other Children of Darkness is a silly, partisan distortion.

Nor can you take presidents like Ronald Reagan, George H. W. Bush and George W. Bush and nominees like Bob Dole, John McCain and Mitt Romney and say that the common denominator, the core of their appeal, was racism, nativism and misogyny.

But it is fair to say that there existed in the Republican Party repulsive elements, people who were attracted to racial and ethnic politics and moved by resentment and intolerance rather than a vision of the good. This group was larger than I ever imagined, and at important moments the Republican Party either overlooked them or played to them. Some may have been hoping to appeal to these elements while also containing and moderating them, to sand off the rough edges, to keep them within the coalition but not allow them to become dominant. But the opposite happened. The party guests took over the party.

A kind of perfect storm occurred: the financial crisis of 2008 combined with long-term economic stagnation, significant demographic and cultural changes, utter contempt for the political class and outrage that Republicans were not nullifying President Obama or promoting an agenda connected to their concerns. A friend of mine pointed out to me that part of the problem is that we are drenched in distaste for the actual practice of politics, and there’s an unstated sense among conservative activists in particular that the activity of governing is somehow illegitimate.

Instead of arguing for the dignity and necessity of politics — instead of making the case for why the give and take, the debate and compromise, are both necessary and appropriate — activists and their counterparts in government disparaged it. This helps explain how Mr. Trump seized on deeply anti-political feelings and used them to his advantage, why Republicans so devalued any focus on policy this election season, and why the former reality television star was rewarded for his vast ignorance on issues. That can work only with people who disdain the government and the activity of governing.

All of this was the kindling, and then came the match.

Many of us were aware of the anger and grievances of Republican primary voters, many of which were understandable and some of which were justified. But we did not imagine that these voters, knowing full well the ugly things Mr. Trump represents, would hand him the keys. They did, and now the Republican Party, with its leading figures lining up behind Mr. Trump, cannot escape from him. That is a haunting reality for those of us who have given some part of our lives to a party we believed was flawed but also a force for good and a force for justice.

So what now? The inclination for some is to walk away, to give up on the party. That’s not the path I’m taking, at least not yet. For while the struggle for the nomination is over, the struggle for the soul of the party is not. This is a difficult moment for the Republican Party, but not necessarily a lasting one.

There are plenty of Republicans who either oppose Mr. Trump or are queasy about supporting him. He did not win a majority of the total votes cast in the primary. And while Trumpism is on the ascendancy right now, my expectation is that it will soon be politically and morally discredited, including in the eyes of most Republicans.

If not, and certainly if Mr. Trump wins the presidency, the Republican Party will fully enter its dark age. (Set aside for now the damage he would do to the country.) But if he loses, there will be a pitched battle to rebuild the Republican Party; to make it different and better, more hopeful, humane and in touch with the concerns of both working- and middle-class voters, than it was pre-Trump.

The party many of us will fight for is a conservative one that appeals to rather than alienates nonwhites, that doesn’t view decency as a sign of weakness or confuse bullying and bluster with strength, and that aims to channel aspirations rather than stoke resentments and organize hatreds.

That vision of the Republican Party will not be on display this week in Cleveland. The nominee of the party makes that impossible. So Republicans will need to look elsewhere for inspiration. In his marvelous biography of Abraham Lincoln, originally published in 1916, Lord Charnwood said of him,

This most unrelenting enemy to the project of the Confederacy was the one man who had quite purged his heart and mind from hatred or even anger towards his fellow-countrymen of the South.

Lord Charnwood added,

For perhaps not many conquerors, and certainly few successful statesmen, have escaped the tendency of power to harden or at least to narrow their human sympathies; but in this man a natural wealth of tender compassion became richer and more tender while in the stress of deadly conflict he developed an astounding strength.

In every important respect, Donald Trump is a repudiation of Lincoln. Win or lose, on the morning after Election Day, Republicans will have to choose whose vision of the party they want to follow.

Peter Wehner, a senior fellow at the Ethics and Public Policy Center, served in the last three Republican administrations and is a contributing opinion writer.