With only a few weeks left in the 2016 primary campaign, a lot of liberal pundits and Democratic Party leaders are getting very nervous about the outlook for the general election. To almost everyone’s surprise, Donald Trump has secured the Republican presidential nomination while Hillary Clinton is still locked in a contentious battle with Bernie Sanders. Although Clinton holds a nearly insurmountable lead over Sanders in pledged delegates, Sanders continues to attack Clinton and win primaries.

There is mounting concern in Democratic Party circles that even after Clinton clinches the nomination, most likely after the California and New Jersey primaries on June 7, she will have difficulty winning over Sanders’ base of young, liberal voters, many of whom identify themselves in exit polls as independents. And without the votes of the overwhelming majority of Sanders’ supporters, Clinton probably cannot win the general election.

But how difficult is it going to be to unite Democratic voters once the primary battle between Clinton and Sanders is over? An examination of survey data from the 2008 presidential election, an election in which Democrats experienced an equally if not more contentious nomination battle between Clinton and Barack Obama, suggests that unifying Democrats may actually be easier in 2016 than it was in 2008. The major reason for this is that Donald Trump is a far less attractive alternative to disgruntled Democrats than John McCain was in 2008. And no matter what Sanders does, someone else should be extremely helpful when it comes to unifying Democrats once the primary contest is over: President Obama.

A look back at the 2008 primary and general election

It is easy to forget just how contentious, and how close, the contest between Clinton and Obama was in 2008. Clinton battled Obama to the very end of the primary season in early June, winning several of the late contests. In the end, Clinton actually won slightly more votes than Obama in Democratic primaries but fell short in terms of delegates because of Obama’s overwhelming margins in caucus states.

And the Clinton-Obama contest was certainly contentious. In late May, Clinton justified her decision to stay in the race after falling behind in the delegate count by recalling the fact that Robert Kennedy was assassinated after the California primary in 1968. She later apologized for this comment. The Clinton-Obama contest also featured a nasty and prolonged battle over the handling of disputed delegates from Florida and Michigan, where Democrats held primaries earlier than permitted according to DNC rules and Obama did not actively compete. That dispute was not settled until shortly before the convention.

It is not surprising that in the heat of the primary battle between Clinton and Obama, a large percentage of each candidate’s supporters indicated that they would not support the other candidate in the general election. In fact, one group of disgruntled Clinton supporters even adopted an acronym to express their sentiments — they called themselves PUMAs, which stood for “Party Unity My Ass.”

In the end, Clinton bowed out of the Democratic nomination contest after the last primaries and strongly endorsed Obama. Clinton gave a powerful speech for Obama at the convention and campaigned enthusiastically for the Obama-Biden ticket during the fall. On Election Day, the vast majority of Clinton’s supporters voted for Obama despite McCain’s attempt to appeal to women by making then-Alaska Gov. Sarah Palin his running mate. According to data from the 2008 American National Election Study, 83% of Clinton primary voters chose Obama over McCain in the general election.

Nor is there any evidence that many Clinton supporters just stayed home in November. According to the ANES data, 94% of Clinton primary voters turned out for the general election, which was almost identical to the 96% general election turnout of Obama primary voters.

Table 1 compares selected political attitudes of Clinton and Obama primary voters in 2008 based on the 2008 ANES. Of course these attitudes were measured late in the general election campaign, long after the primaries had ended. Nevertheless they reveal some interesting differences between Clinton and Obama supporters. First, Clinton supporters were less likely to consider themselves strong Democrats and more likely to identify as weak Democrats or independents than Obama supporters. Second, however, the large majority of independents supporting both Clinton and Obama indicated that they leaned toward the Democratic Party. Only a tiny percentage of Democratic primary voters identified themselves as Republicans or even as independent Republicans.

Table 1: Political attitudes of Clinton and Obama primary voters in 2008

Source: 2008 American National Election Study

The data in Table 1 show that even four months after the end of the Democratic primary race, Clinton supporters had considerably less favorable opinions about Obama than his supporters did. Nevertheless, by November more than two-thirds of Clinton supporters had at least a mildly favorable opinion of Obama, and only one in six had an unfavorable opinion of Obama. No doubt Clinton’s strong support for Obama at the Democratic convention and afterwards helped in that regard.

What is also striking in these data is the fact that a full third of Clinton supporters had a favorable opinion of McCain. And half of Clinton supporters were either favorably disposed toward McCain or neutral toward him. As a result, when it came to comparing the Democratic and Republican candidates, only two-thirds of Clinton supporters viewed Obama more favorably than McCain, and one-sixth rated them equally.

Table 2: General election vote of Clinton primary voters

Source: 2008 American National Election Study

So how did these attitudes translate into November voting decisions? Table 2 displays the relationship between party identification and relative candidate favorability on the one hand and general election vote among Clinton primary voters on the other. Two findings stand out in this table. First, the overwhelming majority of Democratic identifiers and a remarkable 100% of independents leaning toward the Democratic Party ended up voting for Obama. Defections to McCain were concentrated largely among Republicans and pure independents who had voted for Clinton in the Democratic primary.

The second key finding in Table 2 is that defections to McCain were concentrated very heavily among the relatively small group of Clinton primary voters with a more favorable opinion of McCain than Obama — of course many of these voters were also Republican identifiers or leaners. Not surprisingly, almost all Clinton primary voters who rated Obama more favorably than McCain voted for Obama but so did the vast majority of those who rated them equally favorably.

Conclusions: Whither Sanders supporters?

Perhaps the key lesson that we can learn from the results of the 2008 battle between Clinton and Obama is that Sanders supporters probably do not have to love Clinton in order to vote for her in the general election. They merely have to like her as well or better than Trump, and that should be a very easy bar to clear.

Trump has far less appeal to Democratic voters in 2016 than McCain had in 2008. According to the 2008 ANES data, McCain was viewed favorably by 23% of all Democratic identifiers and leaners and unfavorably by 58%. In contrast, according to four recent national polls — CNN, Fox News, CBS News/New York Times, and Public Policy Polling — Donald Trump is viewed favorably by only 5% to 12% of Democratic voters and unfavorably by 82% to 89%. And while these polls did not provide data on Trump favorability among Clinton and Sanders supporters, it seems unlikely that he is viewed more favorably by Sanders voters, who tend to be, if anything, further to the left and more suspicious of billionaires than Clinton supporters.

Of course, we don’t know how the endgame of the 2016 Democratic primary campaign will play out. Although Sanders has pledged not to do anything that would help Trump win the general election, it is not clear when or how he will bow out of the nomination contest, whether he will enthusiastically endorse Clinton before or during the convention, or whether he will actively campaign for Clinton in the fall.

Given the ideological basis of his candidacy with its heavy focus on issues of economic injustice and political reform, Sanders may require considerable persuasion and concessions on the party platform and rules as the price of his support — something Clinton did not require from Obama in 2008. However, because of the extraordinarily negative opinions that Democratic voters currently hold toward Trump, even a fairly tepid endorsement by Sanders may be sufficient to convince the vast majority of his supporters to cast their ballot for Clinton in the general election.

A somewhat greater concern for Democrats in 2016 may be ensuring that Sanders’ youthful supporters actually make it to the polls. A much larger share of Sanders backers than 2008 Clinton backers are under the age of 30, which means they are probably less reliable general election voters. The Clinton campaign clearly will need a strong get-out-the-vote effort and all the help they can get from Sanders in motivating his young supporters to turn out in November. But someone else should also be able to help a great deal with the task of unifying Democrats and increasing turnout among Sanders supporters: President Obama. Fortunately for Clinton, Obama is extremely popular with Democratic voters, including Sanders supporters. In the latest NBC News/Wall Street Journal national poll, Obama’s approval rating among Democrats was 88% and his approval rating among Sanders primary voters was 82%.

Obama has been careful to remain neutral in the contest between Clinton and Sanders. Once the primaries are over, however, there is no doubt that he will enthusiastically endorse and actively campaign for his onetime adversary. And the findings from the NBC News/Wall Street Journal poll suggest that his support could play an important role in persuading Sanders supporters to turn out and vote for Clinton in November.