On Tuesday morning, President Donald Trump congratulated Boris Johnson on his election as the leader of Britain's conservative party and the United Kingdom's next prime minister in a tweet, writing, "he will be great!"

But Trump and Johnson haven't always been on such friendly terms. When Trump was running for president in 2015, Johnson — who was then the Mayor of London — had some harsh words about Trump.

In proposing a plan to ban immigration from majority-Muslim countries, Trump falsely claimed there were neighborhoods in London so "radicalized" by Muslim immigration that police were afraid to go to them.

"When Trump says that there are 'no-go' areas in London, he's betraying stupefying ignorance that makes him frankly unfit for the office of the presidency," Johnson said in 2015.

Visit Business Insider's homepage for more stories.

On Tuesday morning, President Donald Trump congratulated Boris Johnson on his election as the leader of Britain's conservative party and the United Kingdom's new prime minister in a tweet, writing, "he will be great!"

Johnson's ascent to the United Kingdom's top position comes at a critical time for the United States and the United Kingdom's relationship as Johnson is now tasked with completing the UK's official exit from the European Union, a move whose economic and political consequences will reverberate around the globe.

Speaking to reporters last week, Trump predicted Johnson would "straighten out" Brexit and predicted, "I think we'll have a very good relationship," adding, "He's a different kind of a guy, but people say that I'm a different kind of a guy too."

And last month, Johnson shared some praise for Trump's job performance at a Tory event, saying, "he has many good qualities. This is a guy who, when all is said and done, has got the US economy motoring along ... he's cut regulations and cut taxes in a way that has driven growth in the US."

Johnson argued his own party could learn from Trump in emphasizing the values of free-market economics, adding, "I know that not everybody agrees with everything Donald Trump says or does but on that he is having results, and we should pay tribute to that."

But Trump and Johnson haven't always been on such friendly terms. When Trump was running for president in 2015, Johnson — who was then the Mayor of London — had some harsh words about Trump and his immigration policies, even going as far to say that Trump was "unfit" for office.

Read more: 'He will be great': Trump congratulates Boris Johnson on winning the race to become prime minister

Trump has long used the city of London as a punching bag to drum up support for anti-immigration policies, making dubious claims that London is a hotbed of crime because of immigration. As The Guardian reported in 2015, Trump claimed without evidence that Muslim immigration had "radicalized" multiple neighborhoods in cities including Paris and London.

"They have sections in Paris that are radicalized, where the police refuse to go there," Trump falsely claimed. "We have places in London and other places that are so radicalized that the police are afraid for their own lives. We have to be very smart and very vigilant."

In a 2015 interview with ODN, Johnson refuted Trump's comments and said Trump was "out of mind" in proposing a plan to place a temporary ban on immigration to the US from Muslim-majority nations as a measure to curb terrorism.

"What he's doing is playing the game of the terrorists and those who seek to divide us," Johnson said. "And I have to say, when Trump says that there are 'no-go' areas in London, he's betraying stupefying ignorance that makes him frankly unfit for the office of the presidency."

Johnson added: "I would like to invite him to come to see the whole of London and take him around the city, except I wouldn't want to expose any Londoners to the unnecessary risk of meeting Donald Trump."

Read more:

Boris Johnson's long list of gaffes, offensive comments and controversies

What happens now Boris Johnson has won the race to become Britain's next prime minister?

The 5 big problems Britain's next prime minister will have to deal with on his first day

The absurd life of Boris Johnson, the man who backed Brexit and will be the UK's new prime minister