Media playback is unsupported on your device Media caption Donald Trump: "I just learned I got the nomination"

The US Republican presidential candidate Donald Trump has reached the number of delegates needed to secure the party's presidential nomination.

In North Dakota on Thursday, he thanked 15 unbound delegates from the state who he said "got us right over the top".

He defeated 16 other Republican contenders and according to the Associated Press has 1,238 delegates, one more than needed.

Republicans will finalise their nomination at a convention in July.

While Mr Trump has the required amount of delegates, his nomination by a divided Republican Party is not yet secured.

Unbound delegates in the party are free to support the candidate of their choice.

Why has Trump caught Clinton in the polls?

Obama: World leaders 'rattled' by Trump

Trump v Republican elite - the split explained

US election 2016: Primaries, caucuses and delegates

If his nomination is confirmed, Mr Trump will face former US Secretary of State Hillary Clinton or Vermont Senator Bernie Sanders, who are vying for the Democrat nomination.

On Wednesday, the New York billionaire suggested going against Mr Sanders in a TV debate in California before the state's primary on 7 June.

Mr Sanders agreed to the debate in a tweet, saying "Game on".

Image copyright @BernieSanders

On Thursday, Mr Trump said: "The problem with debating Bernie? He's going to lose."

He also threw a barb in Mrs Clinton's direction, saying: "Here I am watching Hillary fight and she can't close the deal. That should be such an easy deal to close."

Earlier, the current US president Barack Obama said that world leaders "had good reason to be rattled" by Mr Trump, whose proposals he said were "either ignorance of world affairs or a cavalier attitude".

In response to that, Mr Trump told reporters in North Dakota that rattling leaders of other countries was a "good thing".

"[President Obama] knows nothing about business," he said.

"Many of the countries in our beautiful world have been absolutely abusing us and taking advantage of us.

"We're going to have great relationships with these countries but if they're rattled in a friendly way that's a good thing, not a bad thing."

Analysis: Anthony Zurcher, North America Reporter

It wasn't a matter of if, only when. With no real obstacles between him and the nomination, Donald Trump was going to cross over the magic 1,237 delegate mark at the latest by the California and New Jersey primaries on 7 June.

It must be a bit of delicious irony for the New York real estate mogul, however, that the Associated Press has declared him the winner thanks to the support of a Republican Party establishment that largely recoiled from him for most of the campaign.

Of course the nomination isn't official until the balloons drop at the Republican convention in July, but the desperate attempts of the #NeverTrump movement to throw any obstacles in his path are essentially extinguished.

While his closest presidential rivals - Ted Cruz, John Kasich and Marco Rubio - have yet to free delegates pledged to support them at the convention, Mr Trump can win the prize with or without their help.

The Republican convention in Cleveland will be the Donald Trump show, and everyone not with him will be spectators or - as his recent criticism of Republican Governor Susanna Martinez of New Mexico has shown - targets.

The delegate tracker

Follow the primaries race with the delegate tracker, provided by the Associated Press (AP)