LONDON - It may be pure coincidence that Donald Trump flew to Scotland on the day that British voters decided to leave the European Union. But in striking ways, the forces fueling Thursday's historic referendum here were similar to those that have shaken U.S. politics to its core in the past year.

On both sides of the Atlantic, political establishments and the elites have found themselves on the defensive. Rising resentment over the fallout from globalization and the effects of the financial collapse of 2008, which has widened the gap between the rich and everyone else, has divided voters in Britain and the United States.

Added to that are emotional issues of national and cultural identity at a time of growing demographic diversity, highlighted in both countries by often-angry debates over immigration. Both Trump and those pushing for Britain to leave the European Union have found the immigration issue to be their most potent political weapon.

Trump's slogan, "Make America Great Again," could easily have been adapted to the messaging of those in the "leave" campaign across the pond. Here, that desire for a return to an earlier time - to make Britain great again - is expressed through the issue of control.

Those who have pushed for Britain to leave the EU want to reclaim a measure of sovereignty by wresting power from the bureaucrats in Brussels, the headquarters of the 28-member bloc. They feel about the EU bureaucracy as tea party Republicans do about the federal government.

Even among people leaning toward a vote to remain in the EU, sending a message to those in power has strong appeal.

Early Thursday, Steve Devereux, an economist and teacher, was passing by the polling place at London's Methodist Central Hall, a short distance from Parliament. If there is any place where sentiment tips heavily in favor of remaining in the EU, it is here, near the seat of government, and Devereux said he was inclined to vote that way.

But he called the choice "really, really complex," in no small part because of dissatisfaction with the status quo. Asked why he would consider a vote to leave, he said, "Giving the government a kick in the backside and really telling them - actually, they can't take people for granted."

On balance, Devereux said he feared that rattling the establishment's doors by voting to leave the EU would pose a great risk. But it is clear that the sense of disgust and disenfranchisement is deep and widespread.

Distrust with political establishments cannot be overstated, on either side of the Atlantic. During the debate here, Michael Gove, a Conservative Party lawmaker and a leading voice in the "leave" campaign, sought to discredit studies warning of the economic consequences of leaving. "People in this country have had enough of experts," he said.

This has not been a year in which the voices of political leaders have carried much sway. In the United States, Republican leaders stood powerless as Trump rolled through the GOP primaries. Hillary Clinton enjoyed the overwhelming support of the Democratic establishment, yet Sen. Bernie Sanders of Vermont ignited a progressive uprising that forced her to battle to the end of the primaries.

In Britain, the leaders of the major parties, led by Prime Minister David Cameron, have banded together to push for a rejection of a British exit from the EU, a move popularly shorthanded to Brexit. Leaders from around the world, including President Barack Obama, have warned of the consequences - for Britain, Europe and the West - of a vote to separate from the bloc.

Still, polls here had shown sentiment to be remarkably split. The latest surveys of voter opinion indicated a movement toward the "remain" side, but political leaders and others favoring an "in" vote approached Thursday's balloting with trepidation, fearful that a populist uprising could carry the "out" campaign to victory.

That same sense of unease has gripped U.S. politicians all year. The choices in the two countries may be different, but what animates the sentiment behind the votes springs largely from the same set of grievances. Even the contours of the electorates are similar. Here, as in the United States, voters are polarized along recognizable lines: young vs. old; college-educated vs. non-college-educated; urban vs. small town and rural.

A SurveyMonkey online poll showed that voters younger than 45 favored the "remain" campaign, with the very youngest overwhelmingly in favor. Those 45 or older supported the "leave" campaign. Similarly, those with a college degree supported the "remain" campaign by a nearly 3-to-1 margin. Those without a degree favored the "leave" campaign, though by a narrower margin.

Chris Hanretty, a specialist in politics at East Anglia University, wrote in the Observer recently, "Older men and women without educational qualifications are very likely to vote for Britain to leave the EU - not because they're stupid or uninformed but because over the past 40 years their relative position within society has worsened."

The poll also showed the significance of the immigration issue among those favoring a Brexit, just as immigration issues were the most powerful force behind Trump's rise.

By better than 2 to 1, those here who cited immigration as their most important issue said they would back Britain's exit. Those worried about the economy, poverty and inequality, or defense and foreign affairs, all backed remaining.

Beyond the issues that have shaped the campaign here and in the United States, there are other parallels. As in the United States, the campaign here has been marked by a coarsening dialogue, befitting perhaps of the age of social media and the culture of cable television.

In this new arena, Trump proved more skillful than his Republican opponents at mastering communication. In Britain, there are complaints that Cameron and others leading the "remain" campaign have been outdone in this category by the likes of Boris Johnson, the flamboyant former mayor of London and a Conservative member of Parliament, whose ambition to take Cameron's job is well known.

Trump is not a beloved figure in Britain, but the choice before Americans in November also appears to be a fault line in the campaign here. Trump has said he would be inclined to vote to leave the EU if he were casting a ballot here.

The SurveyMonkey poll found that people here who said they would support Trump for president if they could vote in the United States backed the "leave" campaign by a significant margin. Those for Clinton said they were voting to remain in the bloc.

Paul Cloutman, 78, a freelance writer outside a polling station in Southwest London, said Thursday morning that the vote was a "head versus heart" decision. He thought that being in the EU meant Britain had "a lack of control over its own destiny," but in the end, "the economic argument won out."

Plus, he said, he did not want to disappoint his son. "My son lives in California, and he said, 'If Trump gets in here and Boris [Johnson] there' after a 'leave' vote, he will have nowhere to live. So he wants me to vote 'in.' "

That's one way voters here are making their decisions, but it will hardly resolve the more fundamental issues - both here and in the United States.