OTTAWA -- Canada will contribute $50 million to a global charity for children's education, Prime Minister Justin Trudeau tweeted to comedian Trevor Noah, a pledge that quickly drew criticism both for its content and its form.

Celebrities gathered in Johannesburg, South Africa on Sunday for the Global Citizen Festival: Mandela 100, a charity concert honouring Nelson Mandela a century after he was born.

Trudeau tweeted to Noah, who is hosting the festival, that Canada would give the money to Education Cannot Wait, an organization that funds education for children affected by conflicts, natural disasters and other crises.

Global Citizen is an organization that wants to end extreme poverty by 2030. Its Mandela 100 campaign sought to bring in US$1 billion in donations, and Global Citizen tweeted that the campaign surpassed that goal, bringing in over $7 billion.

"Hey @Trevornoah - thanks for everything you're doing to celebrate Nelson Mandela's legacy at the #GlblCtzn festival. Sorry I can't be with you - but how about Canada pledges $50M to @EduCannotWait to support education for women & girls around the world? Work for you? Let's do it," Trudeau tweeted to the South African comedian and "The Daily Show" host.

Noah said "This is amazing!" as Trudeau's tweet was shown on a big screen at the concert.

But back in Canada critics were less enthusiastic. Conservative Leader Andrew Scheer accused Trudeau of pledging $50 million in a tweet to impress a TV personality.

"A lot of politicians like to be liked. He likes to have his tweets liked and he likes to have his messages retweeted and shared and it seems to be singularly focused on adulation from celebrities, whereas our party and our caucus is focused on doing what's right by Canadian taxpayers," Scheer said at an appearance in Winnipeg.

Similarly, Conservative MP Michelle Rempel tweeted that Trudeau's message was "tone deaf" and also accused him of trying to get noticed by a TV star and said the money had not been budgeted for.

Louis Belanger, the director of communications for International Development Minister Marie-Claude Bibeau, said the $50 million is part of $400 million in aid previously announced during the G7 Summit in Charlevoix, Que., near Quebec City, in June.

Belanger said Education Cannot Wait is one of the only funds that specifically helps girls' education in places such as refugee camps and war zones.

"This is the type of funding that we had our eye on since we announced it in Quebec City," he said.

Belanger said the decision to announce the $50 million was made three weeks ago but officials had been talking about giving to Education Cannot Wait for months.

He said the organization operates in Jordan, Lebanon and South Sudan and in camps where people have been displaced by the west African terrorist group Boko Haram, for example.

"We think it's important for girls to continue their education and that's why we're moving forward," he said.

Trudeau's principal secretary Gerald Butts took to Twitter to defend the move.

"This money is going to educate women and girls in the developing world, in commemoration of Nelson Mandela's 100th birthday," he tweeted, adding, "And the Leader of the Conservative Party of Canada's reaction..." and included a link to Scheer's tweet.

Toronto-based lawyer and former Liberal staffer Warren Kinsella tweeted that Education Cannot Wait is a worthy cause, but called Trudeau's tweet an "appalling" way for the decision to be communicated, "to a American-based TV host, no less."

With files from The Associated Press

Hey @Trevornoah - thanks for everything you’re doing to celebrate Nelson Mandela’s legacy at the @GlblCtzn festival. Sorry I can’t be with you - but how about Canada pledges $50M to @EduCannotWait to support education for women & girls around the world? Work for you? Let’s do it. — Justin Trudeau (@JustinTrudeau) December 2, 2018

Pledging $50 million in a tweet to impress a TV personality?



Taxpayers need a defender not somebody who throws their money around to be popular with celebrities.



This is how deficits become massive and permanent. https://t.co/lBdAtzH0eX — Andrew Scheer (@AndrewScheer) December 3, 2018