Democratic presidential nominee Hillary Clinton’s campaign spent months carefully crafting her position on the Keystone XL oil pipeline, including cutting all mention of the contentious project from her latest book.

Campaign staffers debated the most opportune moment for the former secretary of state to finally announce her position on Keystone XL, according to leaked emails from longtime Clinton ally and lobbyist John Podesta published by the website WikiLeaks.

Clinton officially came out against the Keystone XL pipeline in September, 2015, but only after spending months refusing to publicly take a stance on the $7 billion project that would have brought 510,000 barrels per day of oil sands from Alberta, Canada to refineries on the U.S. Gulf Coast.

Now, we have a pretty good idea of why. Clinton insiders debated cutting any mention of Keystone XL from her book “Hard Choices” as early as April 2014 — about a year before she declared her candidacy for president.

“Unless you feel some need to mention it, I’m not sure what the gain is,” editor Jonathan Karp told Clinton speechwriter Dan Schwerin, according to a leaked email chain.

“You say you’re waiting for the study before making a determination, but I question whether any study is capable of defining a clear course of action, and some readers might think that relying on a study is a stalling tactic,” Karp said, adding that the only reason Clinton put it in her book was on the advice of her daughter, Chelsea.

Podesta, who was a White House adviser at the time, told Clinton staffers to “cut” any mention of Keystone from the book.

“Great. The Secretary is open to cutting and thinks maybe we’ll add a few more lines on the promise of clean energy instead. John, if you have ideas on that, please let me know,” Clinton speechwriter Dan Schwerin wrote back to Podesta.

“So we’re officially cutting Keystone and here¹s the domestic energy section,” Schwerin later wrote to Podesta, sharing with him the edited text of Clinton’s book.

Keystone XL was one of the main energy political fights at the time, and the project created a rift among traditional Democratic supporters. Trade unions favored building the project because of the promise of thousands of jobs, and environmentalists wanted the pipeline to be vetoed by the Obama administration over global warming concerns.

Clinton campaign staffers were even worried that remarks she made to financial industry representatives in June, 2014, could be construed as “pro Keystone,” according to Wikileaks-released emails. These were remarks from speeches she gave to financial institutions that she refused to make public.

Clinton stayed away from the issue since it was her State Department that began the environmental review of Keystone XL. But even after she left the Obama administration in 2013, Clinton refused to weigh in on the project.

Leaked emails from Wikileaks, however, show Clinton planned to come out against Keystone as early as April, 2015.

“The enviros may latch onto this going forward,” Clinton campaign strategist Robby Mook wrote in an email to other top campaign officials on April 19th regarding a New York Times story on the Clinton Foundation getting donations from a Canadian bank that’s a shareholder in Keystone XL.

“Have we discussed when she will come out against Keystone? After POTUS vetoes? and more than $1 million in payments to Mr. Clinton by a Canadian bank and major shareholder in the Keystone XL … oil pipeline around the time the project was being debated in the State Department,” Mook wrote.

The emails were sent just days before Clinton told supporters at a New Hampshire campaign event she would wait to see what President Obama said on the pipeline.

“This is President Obama’s decision, and I am not going to second guess him because I was in a position to set this in motion, and I do not think that would be the right thing. So I want to wait and see what he and Secretary Kerry decide,” she said.

But by August, 2015, it became apparent Obama was poised to veto Keystone XL. Trade union officials were concerned the Clinton campaign would put out a statement in support of Obama’s decision.

“The trades are also hearing that HRC will put out a statement stating that she encouraged Obama to take this position,” Nikki Budzinski, the campaign’s head of labor outreach, wrote in an Aug. 20 email.

“Politically with the building trades, this would be a very dangerous posture. Just curious what your thoughts will be if the situation goes this way on Monday,” she wrote.

“[You’re] in trouble, girl,” Podesta responded. “Seriously, doubt we’ll say we ‘encouraged’ but assume we’ll support if it goes that way.”

Clinton adviser Amanda Renteria said they’re “so close to getting bldg trades and if we do this right, it will be ok even though they won’t like it.”

Campaign staffers even crafted a series of talking points to “soften the blow” to trade unions on Keystone XL, which was basically a list of infrastructure initiatives to keep unions happy.

“Ideally to get passed the Sept 9 meeting with the Building trades would be a personal god-send,” Budzinski wrote.

The campaign published Clinton’s anti-Keystone XL oped on Sept. 25th — 16 days after their meeting with union officials.

The Obama administration formally rejected Keystone XL in November, 2015.

Follow Michael on Facebook and Twitter

Content created by The Daily Caller News Foundation is available without charge to any eligible news publisher that can provide a large audience. For licensing opportunities of our original content, please contact licensing@dailycallernewsfoundation.org.