All week, Republican presidential nominee Donald Trump has been warning his supporters to expect rampant voter fraud.

Donald Trump speaks at the third and final 2016 presidential campaign debate in Las Vegas, Nevada, U.S., October 19, 2016. REUTERS/Joe Raedle/Pool

He doubled down on this during the third presidential debate on Wednesday, citing the “millions” of names added to the “bloated” voter rolls as one reason he might not be able to accept the election results. “I will tell you at the time,” he said, essentially suggesting that voter fraud could delegitimize the November 8 outcome.

Trump has often tweeted about the impending election being “rigged” or “stolen,” which led one supporter to believe Democrats will pay homeless people in Chicago to vote for Democratic presidential nominee Hillary Clinton.

Trump has also offered an answer for this fake voter problem: Supporters should monitor the polls and look for “suspicious” behavior, singling out cities like Philadelphia, Chicago and St. Louis. All have large African-American communities.

Both the voting problems and the solution Trump has cited reach back to America’s darker past. He is warning against a specific strain of voter fraud rooted in urban political machines across the Northeast and Midwest in the late 19th and early 20th centuries. His remedy is a different type of historic voter fraud – one rooted in the Jim Crow South.

Reforms of the past four decades have made the power of corrupt urban machines – one often-quoted adage was “Vote early and often” – legend rather than reality. Yet “dead voting Democrats” and fears of rigged elections are now key Trump talking points. He manipulates history to justify a return to a sorrowful period in the South defined by racial violence and systematic violation of voting rights.

MORE DEBATE COVERAGE

Trump suggests he may reject election result

Debate highlights: Trump calls Clinton a 'nasty woman'

VERBATIM: Kasich on rigged election talk: 'A big fat joke'

The history of American elections is one of violence, fraud, corruption, bribery, and dirty tricks. Yet it is also a history of robust reform to fix these problems -- a narrative Trump ignores. Despite Republican-controlled state legislatures’ recent attempts to pass voter-ID laws that explicitly aim to disenfranchise minority voters, U.S. voting history is one of ever-increasing democratization and transparency.

During the Gilded Age, manipulated elections abounded, though as they took on very different regional shapes.

In the Northeast and Midwest, voter corruption played out largely in cities. Precinct leaders of urban political machines like Tammany Hall in New York, or Frank Hague’s in Jersey City, New Jersey, encouraged a range of new immigrants and workers to come to the polls. Then strong-armed how they pulled the lever.

Slideshow ( 5 images )

The machines used patronage jobs to command favor. On Election Day, they would offer saloon patrons rounds of drinks for voting a particular ticket. Most important, they had a say in tallying the votes – and, yes, they notoriously stuffed ballot boxes or had voters cast their ballots multiple times.

Public service in this era was often about getting rich: Local precinct leaders, like George Washington Plunkitt in New York, celebrated their ability to make a profit off government service in what Plunkitt called an “honest graft.”

But, using the newly harnessed power of public opinion, muckraking journalists like Lincoln Steffens aligned with the settlement house movement to shed light on cities overrun by corrupt politicians and police. The reform impulse gradually took hold.

The early 20th century ushered in systematic changes such as the 17th Amendment (1913), which allowed voters to elect their senators directly, secret ballots, primary campaigns and referendums.

But these changes, with the exception of the 17th amendment, could not be implemented nationally, because states control the voting rules and procedures. So reforms were slow to take effect.

Meanwhile, a different form of vote manipulation had flowered in the South. Rather than bulking up the number of people who turned out to vote, this tactic was about keeping people away from the polls. With Jim Crow politics, white supremacists formed White Government Leagues and used violence, intimidation and even public lynchings to prevent black voters from participating in American civic life.

In Wilmington, North Carolina, for example, as the local black middle class made economic and political gains, white supremacists mobilized in 1898. White men and women formed Red Shirt armies to regain control of local politics through force. They disseminated fear through newspapers stories about what black men would do to white women if they were not “monitored.” Before Election Day, the Red Shirts launched a reign of terror on the black community, including house-to-house searches, public harassment, beatings and even murder.

RELATED COVERAGE

VIDEO Third debate begins with no handshake

VIDEO Battle over abortion rights in final debate

VIDEO Ivanka Trump says father will respect election results

The result: Days of racial violence that lead to 14 African-American deaths and the establishment of legal and extralegal traditions that kept African Americans disenfranchised in North Carolina for more than a half a century.

In states like Illinois, though, it was powerful urban machines that blocked reforms and retained control of municipal politics. By mid-century, Illinois still had an unsavory reputation for vote fraud, which Trump’s two leading surrogates, former House Speaker Newt Gingrich and former New York City Mayor Rudy Giuliani, now regularly cite.

Illinois’ corruption was bipartisan. Republicans dominated suburban and rural areas, stuffing ballot boxes “downstate;” Democratic Mayor Richard J. Daley, who ran Chicago, had precinct captains resurrect the dead to vote for Senator John F. Kennedy in 1960.

The 1960 presidential election, however, was essentially the last gasp of power for political bosses like Daley. During the decade that followed, the Democratic Party dramatically transformed in content and structure.

The party re-aligned, with African Americans emerging as a vital constituency and civil rights as an explicit goal. The civil rights movement confronted Southern sheriffs and white supremacist groups and advocated voting laws that would bolster African American participation. President Lyndon B. Johnson played a major role, orchestrating the 1964 Civil Rights Act and 1965 Voting Rights Act.

Disaffected white Southerners moved to the Republican Party, which has advanced racially coded messages to support “states’ rights” over the past 40 years.

Kennedy’s win over Vice President Richard M. Nixon was also the beginning of the end of “dead Democrats voting.” JFK had launched an innovative media-driven campaign that allowed him to circumvent the party establishment. He used the primary elections and a Hollywood-style publicity campaign to win the nomination over a powerful party insider, Senate Majority Leader Johnson. Winning the presidency proved the effectiveness of Kennedy’s new approach.

Eight years later, the lingering conflict between the old machine bosses and the new reformers erupted violently during the 1968 Democratic National Convention in Chicago. Daley took on the younger liberals eager to move party politics from smoke-filled rooms to a transparent nomination process.

The riots in Lincoln and Grant Park, where young activists faced off against Daley’s Chicago police officers just outside the convention hall, may have helped lead to Nixon’s victory that year. But they also led to major reforms in the Democratic Party. It changed to an open primary system, which its architect George McGovern called the “end to the day of the boss.”

These twinned histories of vote manipulation in the United States now shape Trump’s narrative about rigged elections in potentially dangerous ways. The story of a “dead voting Democrats” is a chapter of history that is over. Scholars and judges have repeatedly found modern cases of voter fraud extraordinarily rare.

But Trump has capitalized on this myth to embolden a potentially violent revival of the post-Reconstruction Red Shirt leagues. A 21st century version of Jim Crow voter manipulation could threaten all the decades of voting reforms that have helped create a more tolerant – and more democratic – America.