British Prime Minister Theresa May has said that a meeting of the Group of Seven leaders in Canada had been "difficult" and that countries had to avoid taking unilateral action in order to protect the global trading system.

A divisive summit in Canada at the weekend ended with US President Donald Trump firing off a volley of tweets, venting anger against NATO allies, the European Union and Canadian Prime Minister Justin Trudeau.

Mr Trump has slapped import tariffs on metals, saying he has to protect American jobs against what he says is unfair competition.

"This was a difficult summit with, at times, some very candid discussions," Ms May told parliament in London.

Having left the G7 summit early, Mr Trump's announcement that he was backing out of a joint communiqué torpedoed what appeared to be a fragile consensus on the trade dispute between Washington and its main allies

Mrs May said that she would not ignore the concerns of allies, but that multilateral action was the right way to address the problems caused by globalisation for workers in some countries.

"It cannot be done by taking unilateral action against your partners," she said. "So at this summit, we expressed deep disappointment at the unjustified decision of the United States to apply tariffs to steel and aluminium imports."

Mrs May warned of the risks of a tit-for-tat escalation of the trade dispute and said Britain continued to support the G7communiqué, which mentioned the need for "free, fair, and mutually beneficial trade" and the importance of fighting protectionism.

The G7 groups the United States, Japan, Germany, France, Britain, Italy and Canada.

The US and Canada swung sharply toward a diplomatic and trade crisis as top White House advisers lashed out at Mr Trudeau a day after Mr Trump called him "very dishonest and weak".

"Canada does not conduct its diplomacy through ad hominem attacks... and we refrain particularly from ad hominem attacks when it comes to a close ally," Canadian Foreign Minister Chrystia Freeland told reporters.

Ms Freeland reiterated that Canada would retaliate to US tariffs in a measured and reciprocal way, adding the country would always be willing to talk.

EU will act against US tariffs on steel, aluminium - Merkel
G7 leaders commit to fighting trade protectionism

Mr Trump, who is in Singapore for a historical summit with North Korean leader Kim Jong-un, escalated his war of words with Canada and the European Union in a pair of tweets.

Mr Trump said: "Fair Trade is now to be called Fool Trade if it is not Reciprocal" and suggested that Canada was profiting from US trade, citing what he said was a Canadian press release. "Then Justin acts hurt when called out!"

He again suggested the United States was footing too much of the costs of NATO and "protecting many of these same countries that rip us off" on trade.

The EU, he added "should pay much more for Military!"

Mr Trump had arrived in Singapore for the summit with the North Korean leader King Jong-un that could lay the groundwork for ending a nuclear stand-off between the old foes.

White House economic adviser Larry Kudlow accused Mr Trudeau of betraying Mr Trump with "polarising" statements on trade policy that risked making the US leader look weak ahead of the historic summit with Mr Kim.

"(Trudeau) really kind of stabbed us in the back," Mr Kudlow, the director of the National Economic Council who had accompanied Mr Trump to Canada, said on US television.

Mr Trudeau, in Quebec City for bilateral meetings with non-G7 leaders after the summit, did not comment as he arrived.