SHIMA, Japan (AP) — President Barack Obama said Thursday that foreign leaders are "rattled" by Donald Trump and have good reason to feel that way, as he accused the presumptive Republican presidential nominee of ignorance about world affairs.

Weighing in on the Democratic race to replace him, Obama also downplayed concerns that the protracted fight between Hillary Clinton and Bernie Sanders is hurting his party's chances, brushing off their escalating attacks as the inevitable "grumpiness" of a primary campaign.

Obama offered his assessment of the presidential campaign on the sidelines of a Group of Seven advanced economies summit in Japan, the latest world gathering to be colored by global concerns about Trump. Obama said foreign leaders at the conference were unsure how seriously to take his pronouncements.

"They are rattled by it — and for good reason," Obama said. "Because a lot of the proposals he has made display either ignorance of world affairs, or a cavalier attitude, or an interest in getting tweets and headlines."

Trump, campaigning in Bismarck, N.D., lashed back at Obama, saying "he's a person who's done a terrible job." Referring to foreign leaders, Trump said, "If they're rattled in a friendly way, that's a good thing, not a bad thing."

Questions about the unpredictable Trump have increasingly trailed Obama when he travels overseas, with world leaders incredulously sizing up a leading presidential candidate who speaks of banning Muslim immigration, starting trade wars and spreading nuclear weapons to Japan and South Korea. Obama has said that Trump now comes up in every one of his foreign meetings, with the president offering reassurances that he doesn't believe Trump will be elected.

Though Obama has generally avoided opining on the presidential race as the Democratic primary as it continues to play out, he's made no secret of his distaste for Trump, whose election would mark a sharp departure from Obama in both tone and substance. In addition to opposing the sweeping Asia-Pacific free trade deal that Obama brokered, Trump has threatened to renegotiate Obama's nuclear deal with Iran and the global climate pact reached in Paris.

Obama, taking questions the day before he pays a historic visit to Hiroshima, said foreign countries pay more attention to U.S. elections than Americans do to theirs because they count on the U.S. to provide stability and direction in addressing global challenges.

"I think it's fair to say they are surprised by the Republican nominee," Obama said, referring to Trump.

Obama's comments to reporters came amid growing Democratic impatience to see the party unite behind Clinton, who is close to netting the number of delegates needed for the nomination but has been unable to persuade Sanders to exit the race. Many Democrats, including prominent senators, have started publicly voicing frustration with Sanders, who shows no signs of a quick departure despite near-impossible odds of overtaking Clinton.

Rather, Sanders has warned of a potentially "messy" Democratic Convention in Philadelphia in July, stoking concerns for the Democratic Party and for Clinton's campaign, both of which are eager to shift their focus to attacking Trump and courting voters needed to win the general election in November.

Yet Obama brushed off calls for him to get more personally involved in brokering a resolution, saying that he's still inclined to let the Democratic primary play itself out. He likened the hard-fought campaign between Clinton and Sanders to the one he waged with Clinton in 2008.

"During primaries, people get a little grumpy with each other. Somebody's supporter pops off and there's a certain buildup of aggravation," Obama said. "Every little speed bump, conflict trash-talking that takes place is elevated."

He urged both Democratic candidates to "try to stick to the issues," adding that the grumpiness often stems from voters' frustration when the campaign instead becomes dominated by talk about "personalities and character."

Asked about the Taliban's new leader, Obama said he was not optimistic about a change for the better any time soon despite the U.S. drone strike that killed former Taliban chief Mullah Akhtar Mansour, who had refused to engage in reconciliation talks with Afghanistan's government.

Mansour's replacement, Mullah Haibatullah Akhundzada, has signaled intentions to continue Mansour's aggressive approach. But Obama said he never expected "a liberal Democrat" to be the newly appointed leader of the Taliban.

"In the short term, we anticipate the Taliban will continue to pursue an agenda of violence," Obama said. He added that he was hopeful that eventually "when there are those within the community that surround the Taliban that recognize their goals are best achieved by negotiations."

President Barack Obama speaks during a news conference at the Shima Kanko Hotel in Shima, Japan, Thursday, May 26, 2016, after completion the third working session of the G-7 Summit. (AP Photo/Carolyn Kaster)

President Barack Obama leaves the podium after a news conference at the Shima Kanko Hotel in Shima, Japan, Thursday, May 26, 2016, after completing the third working session of the G-7 Summit. (AP Photo/Carolyn Kaster)

ATLANTA (AP) — Stacey Abrams broke the rules of politics until the very end.The Georgia Democrat who came about 60,000 votes shy of becoming America's first black female governor refused to follow the traditional script for defeated politicians who offer gracious congratulations to their victorious competitor and gently exit the stage.

NEW YORK (AP) — Even before they announce their White House intentions, New Hampshire's ambitious neighbors are in the midst of a shadow campaign to shape the nation's first presidential primary election of the 2020 season.

TALLAHASSEE, Fla. (AP) — Democratic Sen. Bill Nelson, a Florida political icon whose career highlight may have been a trip on the space shuttle, conceded his bitterly close re-election bid to Republican Rick Scott on Sunday, ceding a razor-thin race to the outgoing governor after a tense and sometimes turbulent recount.

TALLAHASSEE, Fla. (AP) — Andrew Gillum, who tried to energize Florida's young and minority voters through a Democratic coalition seeking to end two decades of Republican control of the governor's office, ended his hard-fought campaign Saturday as the state's first black nominee for the post.

TALLAHASSEE, Fla. (AP) — Andrew Gillum, who tried to energize Florida's young and minority voters through a Democratic coalition seeking to end two decades of Republican control of the governor's office, ended his hard-fought campaign Saturday as the state's first black nominee for the post.