Everyone is struggling to understand why so many whites—including many who are not suffering economically—are rallying to the angry words and fearful music of Donald Trump’s presidential campaign. Meanwhile, blacks and other minorities are sticking with the status-quo incrementalism of Hillary Clinton. It’s an odd juxtaposition, but there’s an explanation, one with far-reaching ramifications. A wide and growing optimism gap has opened between poor and middle-class whites and their counterparts of other races—and the former are the congenital pessimists.

My research finds deep divisions in our country—not just in terms of income and opportunity, but in terms of hopes and dreams. The highest costs of being poor in the U.S. are not in the form of material goods or basic services, as in developing countries, but in the form of unhappiness, stress, and lack of hope. What is most surprising, though, is that the most desperate groups are not minorities who have traditionally been discriminated against, but poor and near-poor whites. And of all racial groups in poverty, blacks are the most optimistic about their futures.

Based on a question in a Gallup survey asking respondents where they expected their life satisfaction to be in five years (on a 0-10 point scale), I find that among the poor, the group that scores the highest is poor blacks. The least optimistic group by far is poor whites. The average score of poor blacks is large enough to eliminate the difference in optimism about the future between being poor and being middle class (e.g. removing the large negative effect of poverty), and they are almost three times more likely to be higher up on the optimism scale than are poor whites. Poor Hispanics are also more optimistic than poor whites, but the gaps between their scores are not as large as those between blacks and whites.

In terms of stress—a marker of ill-being—there are, again, large differences across races. Poor whites are the most stressed group and are 17.8 percent more likely to experience stress in the previous day than middle-class whites. In contrast, middle-class blacks are 49 percent less likely to experience stress than middle-class whites, and poor blacks are 52 percent less likely to experience stress than poor whites (e.g. their odds of experiencing stress are roughly half those of poor whites.

Why does this matter? Individuals with high levels of well-being have better outcomes; they believe in their futures and invest in them. In contrast, those without hope for their futures typically do not make such investments. Remarkably, the poor in the U.S. (on average) are less likely to believe that hard work will get them ahead than are the poor in Latin America. Their lack of hope is even evident in the words they use, as David Leonhardt (2015) found in a Google search. The words of the wealthy—such as iPads, foam rollers, and exotic travel destinations—reflect knowledge acquisition and health-conscious behaviors; those of the poor — such as guns, video games, diabetes, and fad diets—reflect desperation, short-term outlooks, and patched-together solutions.

What explains optimism among poor blacks compared to their white counterparts? Some scholars, such as Jeremy Jackson at the University of Michigan, highlight high levels of resilience and a strong sense of community among blacks, something which our data also suggests. There also may be an Obama effect, given the historical marker made by the election of the first African-American president, and support for President Obama remained steady among blacks over the course of his tenure.

And despite visible manifestations of black frustration, as in Baltimore and Ferguson, Mo., and continued gaps in wage, mobility, and education outcomes, there has been black progress. As Eduardo Porter of the New York Times wrote in 2015, at the same time that the gaps in achievement and proficiency have widened across income groups, they have narrowed between blacks (and Hispanics) and whites: The proficiency gap between the poor and the rich is nearly twice as large as that between black and white children. The overall black-white wage gap has also narrowed (black males earned 69 percent of the median wage for white males in 1970 and 75 percent by 2013 [CPS, 2014]).The gap in life expectancy between blacks and whites has also narrowed to its lowest point in history—3.4 years , at 75.6 years for blacks and 79 years for whites.

Poor and high school-educated whites have fallen in status, at least in relative terms. Andrew Cherlin (2016) finds that poor and middle-class blacks are more likely to compare themselves to parents who were worse off than they are, while most blue-collar whites are insecure and facing much more competition for jobs than their parents did. And the markers of their desperation are increasingly evident. Take the increase in mortality rates related to opioid addiction, suicide and other preventable causes among uneducated whites—but not blacks and Hispanics—which was first highlighted in a 2015 study by Anne Case and Angus Deaton, and has since been reported by others, including Joel Achenbach, Dan Keating, and colleagues (2016) in the Washington Post.

Another part of this story is the increasing distance between the lives of those at the top and bottom of the income distribution. Fear of falling behind is even starker if “success” is increasingly out of reach. Sergio Pinto and I (2016), for example, find that poor respondents who live in more unequal cities and suburbs report more stress and worry than those in more equal ones (based on Gallup data). And both poor and rich respondents who live in more unequal areas are less likely to report having family and friends they can rely on in times of need.

The American Dream of prosperity, equal opportunity, and stable democracy is being challenged by increasing income inequality, the hollowing out of the middle class, decreasing wages and increased insecurity for low-skilled workers, and rising mortality rates. We were, until recently, caught by surprise by the depth and breadth of the problem. If it does nothing else positive for our country, the widespread alarm caused by Donald Trump’s political rise and his promises to build walls, ban trade, and create further divisions within our society has woken us up.

The depth and scope of this problem requires difficult political fixes, such as long-term investments in public health and education. It requires developing new forms of social assistance—and language—which encourage hope rather than stigmatize poor recipients—something that Latin Americans have done successfully in recent years. It also requires reducing the distance between the lives of the rich and the poor, so that attaining success—and living the American Dream—is not something that seems forever out of reach for the poor. Finally, tracking well-being as a complement to GDP, as many countries are already doing, would provide an important gauge of the happiness and health of our society in the future—and prevent us from being as surprised by such trends as we were this time.

Carol Graham is the Leo Pasvolsky senior fellow at the Brookings Institution and author of “Happiness for All? Unequal Lives and Hopes in the Land of the Dream” (Princeton University Press, forthcoming).