Donald Trump is very publicly freaking out about election fraud. He has tweeted multiple times about it, complaining that the election will be rigged against him — conveniently, as Hillary Clinton’s lead in the polls continues to grow.

It’s really no mystery where all this bluster — with no evidence of actual voter fraud to back it up — came from: the Republican Party.

Over the past few years, Republicans in many states took an opportunity — enabled by a 2013 Supreme Court ruling — to pass a series of new restrictions on voting. Critics said the restrictions disproportionately hurt minority voters. But Republican backers, at least in public, have pointed to a single issue to defend the measures: voter fraud.

A previous report by the US Department of Justice captured the sentiment among many Republicans: Rep.﻿ Sue Burmeister, a lead sponsor of Georgia’s voter restriction law, told the Justice Department that “if there are fewer black voters because of this bill, it will only be because there is less opportunity for fraud. [Burmeister] said that when black voters in her black precincts are not paid to vote, they do not go to the polls.” Other Republicans, such as North Carolina Gov. Pat McCrory and Iowa Rep. Steve King, have similarly warned about the dangers of voter fraud.

Trump isn’t even the first Republican presidential candidate to raise concerns about voter fraud. Back in 2008, many Republicans, with the support of conservative media outlets like Fox News, pushed concerns that ACORN — a community organization that focused in part on registering African-American voters — was engaging in mass-scale election fraud. At the time, Republican nominee John McCain warned that ACORN “is now on the verge of maybe perpetrating one of the greatest frauds in voter history in this country, maybe destroying the fabric of democracy.”

Touting these concerns, 14 states have passed new voting restrictions — from strict photo ID requirements to limits on early voting — in time for the 2016 election: Alabama, Arizona, Indiana, Kansas, Mississippi, Nebraska, New Hampshire, Ohio, Rhode Island, South Carolina, Tennessee, Texas, Virginia, and Wisconsin. Other states passed restrictions, but they’re currently tied up in court battles.

Trump himself has referenced voter ID laws when pushing his claims that the election is rigged. He told Fox News anchor Bill O’Reilly, “I’m looking at all of these [court] decisions coming on down from the standpoint of identification, voter ID. And I’m saying, ‘What do you mean, you don’t have to have voter ID to now go in and vote?’ And it’s a little bit scary. … People are going to walk in, they are going to vote 10 times maybe.”

So there is a long history here. As unusual as Trump is in many ways, the idea of large-scale voter fraud is something that Republicans were perpetuating before Trump was their nominee for president.

There’s just one problem: As much as Republicans and now Trump have freaked out about voter fraud, the evidence suggests it’s extremely rare — and it’s never swung a presidential election.

Voter fraud is nearly nonexistent

Republicans’ voting restrictions tend to require a photo ID to vote — and what kind of photo ID is eligible can be strictly defined to not allow, for example, a school ID. Some laws also eliminate some or all early voting days. And they might limit when someone can register to vote, particularly so they can’t register and vote on the same day.

These restrictions can significantly hinder some people’s ability to vote. Fewer early voting days and narrower windows to register to vote limit when a voter, especially someone with a busy work or family schedule, can sign up to vote and cast a ballot. And for some, an eligible photo ID may be too costly, or they might not have the time or means to make a trip to a DMV to get the only form of ID that’s allowed.

The justification for all of this, supposedly, is to limit voter fraud.

But the type of voter fraud these initiatives target is nonexistent to extremely rare. Loyola Law School professor Justin Levitt has tracked credible allegations of in-person voter impersonation for years. He found 35 total credible allegations between 2000 and 2014, when more than 800 million ballots were cast in national general elections and hundreds of millions more were cast in primary, municipal, special, and other elections.

There are other kinds of voter fraud, such as vote buying, insider ballot box stuffing, double voting, and voting by people who turn out to be ineligible. All of these are also extremely rare, and there’s no evidence they have swung national elections, according to experts (and even Breitbart, a pro-Trump outlet).

But the focus is mainly on in-person voter fraud. By requiring a photo ID and limiting voting times, Republican lawmakers claim they want to stop fraudulent voters before they can even cast their ballots.

Trump has taken it a step further, arguing that beyond new laws, he wants his supporters to monitor elections for suspicious activity. His website, for example, provides a form to sign up to become an “election observer” to help “Stop Crooked Hillary From Rigging This Election!”

This is all part of the same message: If Republicans and their supporters really believe that a lot of people who aren’t eligible to vote are nonetheless voting on Election Day, why wouldn’t they try to check out polling booths to make sure nothing bad is going on?

The voter fraud myth is dangerous — especially for minority voters

Republicans have long been playing with fire with this rhetoric. Claims of widespread voter fraud challenge the legitimacy of American democracy. Healthy democracies rely on people trusting the results of an election. But if people don’t feel that their voices are being heard or that they’re being treated fairly, they’re much more likely to try to take matters into their own hands — by intimidating other voters, inciting violence, or worse.

But there’s another potential consequences: New voting restrictions — and so-called “election monitors” — may target minority voters.

One widely cited 2006 study by the Brennan Center found voter ID laws, for instance, disproportionately impacted eligible black voters: 25 percent of black voting-age citizens did not have a government-issued photo ID, compared with 8 percent of white voting-age citizens. And a study for the Black Youth Project, which analyzed 2012 voting data for people ages 18 to 29, found 72.9 percent of young black voters and 60.8 percent of young Hispanic voters were asked for IDs to vote, compared with 50.8 percent of young white voters.

For civil rights groups, the restrictions hark back to the days of poll taxes, literacy tests, and other rules that were imposed to block minorities from voting until the Voting Rights Act of 1965 effectively banned such laws. Like modern voting restrictions, the old laws didn’t appear to racially discriminate at face value — but due to selective enforcement and socioeconomic disparities, they disproportionately kept out black voters.

Trump’s call for “election observers” may produce the same kind of disparities. For example, here is how one Trump supporter explained his Election Day plans to the Boston Globe:

“I’ll look for … well, it’s called racial profiling. Mexicans. Syrians. People who can’t speak American,” he said. “I’m going to go right up behind them. I’ll do everything legally. I want to see if they are accountable. I’m not going to do anything illegal. I’m going to make them a little bit nervous.”

In other words, Trump voters expect that the fraudulent voters will be nonwhite. So they’ll target nonwhite voters to make sure they don’t break the law.

Just like voting restrictions, then, selective enforcement and “monitoring” could put extra hurdles mostly on minority voters.

This essentially puts the lie to voter restrictions and Trump’s claims. The real concern does not seem to be voter fraud, but rather that minority voters may swing elections in Democrats’ favor.

Some Republicans have admitted to this. In 2012, ousted Florida Republican Party Chair Jim Greer told MSNBC that concerns about voter fraud are just a “marketing tool” to justify the suppression of minority voters. “Never one time did we have any discussions where voter fraud was a real issue,” Greer claimed. “It’s simply been created as a marketing tool here in Florida for the right wing that is running state government now to convince voters that what they're doing here is right.”

For Trump, though, there may be another reason for fostering fears about voter fraud: It gives him an easy explanation for justifying his loss in November. Trump has never taken defeat well, based on everything we know about his public persona. Claiming that the election is rigged gives him an easy out: “I didn’t really lose. The whole thing was just skewed!”

Whatever the reason, Trump’s claims of a “rigged election” are merely latching onto the myth that Republicans have built up to pass new voting restrictions — a natural extension of the rhetoric Republicans have fanned for years. So if that rhetoric leads to trouble, it can’t be pinned solely on Trump.

Watch: Fear and loathing at a Trump rally