Republicans also control two-thirds of the 50 state legislatures, allowing them to shape laws on issues at the heart of America’s culture wars: guns, abortion and marijuana.

But when a recording emerged of Mr. Trump boasting about groping women, it struck at the core of a party that prides itself on “values,” and Republican leaders could no longer look the other way.

Some Republican politicians who expressed revulsion at Mr. Trump’s comments might have been acting out of cold political calculation. On Nov. 8, Americans will vote not only to elect a president but also to fill all 435 House seats and 34 of the Senate’s 100 seats. Analysts predict that a crushing defeat for Mr. Trump could cost Republicans their advantage in the Senate and even their control of the House — a prospect that until recently was considered a distant possibility.

It is easy to forget that the Republican Party, now known as an anti-abortion and pro-gun stalwart, originated as the progressive face of American politics.

Founded in 1854 on a platform of opposition to slavery, the party was initially dominated by Northern states, which were more industrial. The first Republican president, Lincoln, held the Union together through the Civil War, during which he issued the Emancipation Proclamation, which led to the abolition of slavery. The party’s nickname, the Grand Old Party, dates from that period, as does its mascot, the elephant, which first appeared in 1874 as a political cartoon in Harper’s Weekly.

In the years before and during the Civil War, the Democratic Party, which dominated the agrarian South, supported slavery. But the tables turned in the 1960s, when the Democratic Party championed an end to segregation and Southern states swung to the Republicans, increasingly the party of conservatism.

Mr. Trump’s campaign has ushered in a new chapter of the conservative story, building a coalition of disaffected voters motivated as much by their anger at government and establishment politics as by any policy issue.