LA MALBAIE, Que. -- Leaders of the G7 alliance produced a carefully crafted communique Saturday that struck a fragile consensus on difficult issues like Russia and trade -- only to have Donald Trump rescind his support after the fact.

Just hours after agreeing to the joint communique with his G7 allies, the U.S. president tweeted from his plane that he had told his officials to abandon American support for the document in an eye-opening move that could threaten the future of the club.

He blamed the summit's host: Prime Minister Justin Trudeau.

"Based on Justin's false statements at his news conference, and the fact that Canada is charging massive Tariffs to our U.S. farmers, workers and companies, I have instructed our U.S. Reps not to endorse the Communique as we look at Tariffs on automobiles flooding the U.S. Market!" Trump wrote in one tweet.

Trump followed it up with a second post that targeted Canada's auto and dairy industries: "PM Justin Trudeau of Canada acted so meek and mild during our @G7 meetings only to give a news conference after I left saying that, 'US Tariffs were kind of insulting' and he 'will not be pushed around.' Very dishonest & weak. Our Tariffs are in response to his of 270% on dairy!"

The tweets resumed the president's attacks on what he had been describing in the leadup to the summit as Canada's unfair trade policies.

They also stepped up Trump's assault on Trudeau himself -- unprecedented in the neighbouring countries' longstanding relationship.

In response, Trudeau's spokesman said the federal government was focused on what was accomplished at the summit.

"The prime minister said nothing he hasn't said before -- both in public and in private conversations with the President," said spokesman Cameron Ahmad.

Later in the evening, during a pre-scheduled photo op, Trudeau was asked about Trump's late tweets about the communique and whether the development could have an impact on the future of the G7.

Trudeau, who was walking on a path near the summit site with Argentinian President Mauricio Macri, declined to answer the questions.

"Good to see you guys," Trudeau said to journalists as he walked past. "It's a beautiful evening, a great weekend."

Heading into the leaders' summit in the Quebec town of La Malbaie, there were deep concerns the G7 was fast becoming a G6 plus one because of a widening gulf between the U.S. and the rest of the group in key areas such as climate and trade.

The group could now be facing an existential crisis. Japanese Prime Minister Shinzo Abe -- a veteran of seven G7 leaders' meetings -- said the Charlevoix summit featured heated exchanges, the likes of which he has never seen.

Before Trump's late-day tirade issued after he left the country, the exclusive club produced a communique exposing other areas of discord.

The document showed the group of rich, developed nations remained divided in the crucial area of protecting the planet from climate change -- and it gave a clear statement that the United States remained the outlier.

The other six G7 nations reiterated their support for the Paris agreement on climate change and acknowledged they would have to continue their fight without the U.S.

But in his closing news conference, Trudeau argued the two-day event was a success.

Trudeau highlighted what he saw as one of the Quebec summit's most-important results. Earlier in the day, G7 countries announced they had raised more than $3.8 billion in an effort with other countries to send the world's poorest girls to school.

"This is what a G7 is supposed to be about -- all of us pulling together and doing things that matter for our citizens and for the world," Trudeau said.

"And on that, this was certainly a success."

Trudeau said the G7 had agreed to an "ambitious" communique, but he acknowledged the leaders left La Malbaie without significantly transforming Trump's increasingly confrontational approach to trade.

Trump angered his G7 allies last week by slapping them with hefty tariffs on steel and aluminum -- a move that prompted Canada and the European Union to threaten duties of their own. During his time in La Malbaie, the U.S. president refused to back down. He has threatened similar action against the auto industry.

"There are always other things we can work on," Trudeau said.

"It's true, we didn't fix all of the planet's problems this weekend in Charlevoix. But we moved things forward in a significant way to build a consensus around many big issues that we were called on to address together."

On trade, the group managed to find some compromise language in the short-lived communique.

The document said the countries underlined the "crucial role" of a rules-based international trading system and the need to continue to fight protectionism. They also noted the importance of "bilateral, regional and plurilateral agreements being open, transparent, inclusive and WTO-consistent."

The G7 also committed to working to ensure they complement the multilateral trade agreements and to modernize the WTO to make it more fair as soon as possible, the document said.

All seven countries agreed to a joint statement on artificial intelligence, global trade, middle class growth, innovation, girls' education, and defending democracies from foreign intrusions.

On climate, however, all G7 members except the U.S. said they support the Paris agreement. The remaining six members promised they "will promote the fight against climate change through collaborative partnerships and work with all relevant partners."

Trudeau said five of the G7 countries agreed to a plastics charter to further protect the environment and oceans. Canadian officials explained that the United States and Japan did not sign on because they did not want to commit to firm targets to reduce plastics.

"The president will continue to say what he says at various occasions," Trudeau said.

"What we did this weekend, was come together, roll up our sleeves and figure out consensus language that we could all agree to on a broad range of issues."

Trump also raised eyebrows by urging the G7 to once again become a G8 by bringing Russia back into the fold.

But Trudeau said he told Trump that he had no desire to see Russia readmitted to the G7.

"It is not something we are even remotely interested in looking at, at this time," he said.

In the communique, the G7 said it planned to take action against Russian election meddling in Western countries.