Just hours after Hillary Clinton dodged a question at the final presidential debate about charges of "pay to play" at the Clinton Foundation, a new batch of WikiLeaks emails surfaced with stunning charges that the candidate herself was at the center of negotiating a $12 million commitment from King Mohammed VI of Morocco.

One of the more remarkable parts of the charge is that the allegation came from Clinton's loyal aide, Huma Abedin, who described the connection in a January 2015 email exchange with two top advisers to the candidate, John Podesta and Robby Mook.

Abedin wrote that "this was HRC's idea" for her to speak at a meeting of the Clinton Global Initiative in Morocco in May 2015 as an explicit condition for the $12 million commitment from the king.

"She created this mess and she knows it," Abedin wrote to Podesta and Mook.

The "mess" refers in part to the fact that the three Clinton advisers were discussing the possibility of the former secretary of state pulling out of speaking at the May 2015 event because it was happening one month after the official launch of her presidential campaign and could raise more questions about her role at the foundation.

In April 2015, Politico reported the Clinton Foundation was accepting a "major donation" of at least $1 million from a Moroccan government-owned company, OCP, a phosphate exporter. Politico added that an official at the foundation said it was "unlikely" Hillary would attend the May 2015 event, just weeks after the April launch of her campaign.

It turns out the amount was far bigger -- $12 million -- and there was a far bigger struggle over whether Clinton would attend because she had a much more extensive role in lining up the money than the public ever knew.

In January 2015, Mook indicated Clinton was still considering whether to attend the event, even though her advisers clearly seemed to be concerned about the appearance of such heavy involvement in the foundation amid questions about its fundraising.

With the subject line, "FYI CGI Africa," Mook sent an email to Podesta and Abedin on January 18, 2015.

"Came up on our call with HRC," wrote Mook. "John flagged the same issues we discussed, Huma. HRC said she's sitll(sic)considering."

Abedin wrote back later that day, and suggested the King would be furious if Clinton pulled out of the event.

"Just to give you some context, the condition upon which the Moroccans agreed to host the meeting was her participation," Abedin wrote. "If hrc was not part if(sic) it, meeting was a non-starter."

Abedin added that CGI had not even come up with the idea to hold the event in Morocco, instead it was generated by Clinton herself.

"This was HRC's idea, our office approached the Moroccans and they 100 percent believe they are doing this at her request," wrote Abedin. "The King has personally committed approx $12 million both for the endowment and to support the meeting."

Since Abedin was writing this in January 2015, after Clinton had already left the State Department, it is unclear if "our office" is a reference to this meeting being something that was set up years earlier while Clinton was still secretary or something that was put together by her personal office after she left the Obama administration.

"What did these donors get in return?" Charles Ortel, a philanthropy expert who has been critical of the Clinton Foundation's practices, said in an interview with Fox News. "We are scratching the surface now."

While Clinton was secretary of state, her department in 2011 charged that the Moroccan government was behind "arbitrary arrests and corruption in all branches of government."

At the final presidential debate in Las Vegas on Wednesday night, Republican nominee Donald Trump demanded Clinton give back large contributions to the foundation from countries with questionable human rights records.

"It's a criminal enterprise," Trump said. "Saudi Arabia giving $25 million, Qatar, all of these countries. You talk about women and women's rights? So these are people that push gays off business -- off buildings. These are people that kill women and treat women horribly. And yet you take their money."

Clinton did not directly answer Trump's attack, instead focusing on her own questions about Trump's foundation as well as what she billed as positive parts of the work of the Clinton Foundation.

"But I am happy, in fact I'm thrilled to talk about the Clinton Foundation, because it is a world-renowned charity and I am so proud of the work that it does," said Clinton, adding it had made it possible for 11 million people around the world with HIV-AIDS to afford treatment.

The moderator of the debate, Chris Wallace of Fox News, also pressed Clinton on the issue of donors getting favors for major contributions.

"Why isn't what happened and what went on between you and the Clinton Foundation, why isn't it what Mr. Trump calls pay to play?" asked Wallace.

"Well, everything I did as secretary of state was in furtherance of our country's interests and our values," said Clinton. "The State Department has said that. I think that's been proven."

Though in the email exchange revealed by Wikileaks, Abedin suggested Clinton initiated the solicitation of the $12 million commitment, and the aide made it clear it was going to cause a major issue with the Moroccan government if the candidate pulled out of the CGI event that ran from May 5-7 of 2015.

"It will break a lot of china to back out now when we had so many opportunities to do it in the past few months," Abedin wrote in January 2015. "She created this mess and she knows it."

Hillary Clinton did not end up attending the event, though Bill and Chelsea Clinton did go to Morocco and moderated various panel discussions.

Lanny Davis, a longtime adviser to the Clinton family, told Fox News that the Clinton Foundation helped 11 million people with AIDS, fed hungry children and said the focus should be on the fact that the Obama administration has said there are indications the government of Russian President Vladimir Putin is behind the hack of Podesta's emails.

"This is the first time we've allowed a foreign power, much less Putin, to interfere," Davis said.

Davis added that he knows that when it comes to the people who have worked at the foundation, "their hearts were in the right place." He acknowledged that any time emails like this leak, there will be "optics" problems.

"When you're in the sausage factory, it doesn't always look so good," Davis said.