Now-public internal emails from Democratic presidential candidate Hillary Clinton's campaign detail how the staffers managed the candidate's policy statements and even policy positions in an effort curry favor with labor leaders. All statements were vetted and scrubbed of anything that the union chiefs might object to.

On at least one issue, the Trans-Pacific Partnership, a major trade deal negotiated the Obama administration, emails show how the campaign reversed position on the matter to win labor's support. The emails also detail how the campaign plotted to make it look as though new details about TPP forced her to switch — well before those details were available to the public or the campaign.

"We don't have the language yet or much documentation to fall back that she will be able to credibly say she reviewed and then therefore weighed in on. If she weighs in now, without viewing the document, some in labor might wonder why she didn't just say she opposed earlier?" Nikki Budzinski, Clinton's labor outreach director, pointed out in a Oct. 6, 2015 email, since obtained and released by WikiLeaks. Her concerns were overruled by campaign manager John Podesta.

In other cases, the emails feature the staff ensuring that only union-friendly spin came out of the campaign. When the Supreme Court, for example, announced in June 2015 that it would hear a case called Friedrichs v. California Teachers Association,with major implications for whether public sector workers could be forced to pay union fees even if they didn't want to, it took staffers several email exchanges before they could agree on a single tweet for Clinton to make.

"I worry about talking 'fees.' I like staying more at platitudes about what unions have done for workers," said Amanda Renteria, the campaign's national political director.

The sensitivity to potential union criticism also creeped into discussions of the Affordable Care Act. In a June email regarding a planned Clinton speech to the American Federation of State County and Muncipal Employees, Budzinski suggested taking out a section relating to the healthcare law. "AFSCME is effected by the Cadillac Tax Issue and so would be complicated to bring up," she said. The "cadillac tax" is a provision of the law that applies to high-premium plans and many union-negotiated ones fall into that category.

Organized labor has long been a tricky issue for Clinton. Though almost all major unions are now endorsing her candidacy, the emails showed she struggled at times to secure their backing. Sen. Bernie Sanders, I-Vt., made a strong bid for them during the party primary. Many in the labor movement were wary of Clinton, a former Walmart board member with close ties to Wall Street. Many unions blame President Bill Clinton signing the North American Free Trade Agreement in 1993 for job losses.

Trade in particular became became a problem for Hillary Clinton when many unions decided to make opposing TPP, which they fear will costs workers jobs, a litmus test issue. Clinton had a hand in negotiating it as Obama's secretary of state and the emails show that her campaign initially favored the deal. Opposing the deal while Obama was still trying to get it through the Senate would have exposed a public rift between the campaign and the White House.

Clinton's position on trade even had her own campaign manager confused. In March 2015, Top staffer Robby Mook emailed, "I can't recall where we landed exactly on trade. Is she going to say she supports it?"

Dan Schwerin, Clinton's speechwriter, shared a draft version of the candidate's position on that and a related issue, trade promotion authority legislation, with others staffers in later that same month. "As you'll recall, the idea here is to use this to lay out her thinking on TPA & TPP ahead of action on the Hill and a joint letter by all the former Secretaries of State and Defense. This draft assumes that she's ultimately going to support both TPA and TPP," he said.

It quickly became apparent that this was a problem that would not go away for the campaign. Mook emailed Jake Sullivan, another campaign official, later that month to warn that he had learned there was potential trouble ahead at a upcoming event featuring AFSCME President Lee Saunders. "They've been told she's going to get asked about TPA/TPP at the Saunders event ... I don't think Lee would ever try to screw her, but I can see someone else doing it."

By the following month the campaign was trying to obscure her position and take a more neutral stance. "One thought: do we need a sentence acknowledging her prior support for TPP?" Sullivan said in a message discussing a new trade statement.

Mook quickly shot that idea down. "Two thoughts: 1) I wouldn't mention prior support. I only see downside to that. 2) I would just do the first paragraph—or just add a sentence onto it about the enviro, labor stuff," he said.

By May 2015, the campaign was getting frazzled on the subject. When Podesta was asked during a closed-door meeting with some campaign donors how they would deal with TPP, he replied, "Can you make it go away?" The story was leaked to the Huffington Post, prompting concern inside the campaign when the website's reporter asked for a comment.

"Do we want to push back/clarify/ 'put in context'?" staffer Karen Finney asked spokeswoman Jennifer Palmieri. In response, Palmieri said she "cannot imagine" that Podesta in fact said that but would check with him. The Huffington Post story ran with the quote intact, indicating the campaign conceded that Podesta did say it.

The campaign continued to hold out in public the possibility that Clinton could back the deal though. "Her trade position has nothing to do with donors and Wall Street. She's stated her criteria for TPP, but hasn't ruled out the possibility that that criteria can be met in a final deal," Podesta told liberal columnist Brent Budowsky in a June 2015 email.

By October liberal opposition to TPP had grown so fierce, the campaign threw in the towel. It was then faced with the problem of how to announce that she was now opposed to TPP without looking like she was being disloyal to Obama, caving into pressure or looking opportunistic. The solution was to pretend that the final draft version of TPP was not what Clinton expected and that the particulars of it forced her to change her stance.

Budzinski said in an Oct. 6, 2015 email that she was "very glad" they were going to oppose TPP because "this will be very helpful with mobilization on the ground and support within labor during and after this primary."

She nevertheless warned that the timing of the announcement was important. In particular they had to wait until the final version of TPP was public for the stance to actually look plausible. While negotiations for the deal had just been concluded, its text was not public at the time and the Clinton campaign did not have access to it.

Podesta said they couldn't do that. The announcement that the negotiations were concluded had brought too much attention to the issue. "We cannot survive hemming and hawing for 3 weeks," he warned.

The following day, Clinton announced on the PBS Newshour that she now opposed TPP. When challenged on the issue by Sanders in a debate the following week, Clinton stuck by the argument that it was the details in the final version of the deal that forced her hand.

"I did say, when I was secretary of state, three years ago, that I hoped it would be the gold standard. It was just finally negotiated last week, and in looking at it, it didn't meet my standards," she said.

It did not escape the attention of many people, including the White House, that Clinton couldn't possibly have known at the time what was in the final draft of the deal. "Yeah, I noticed that too," White House spokesman Josh Earnest told reporters when asked about Clinton's claim.