By Valerie Volcovici
WASHINGTON, Oct 7 (Reuters) - Democratic presidential hopeful Hillary Clinton struggled with how to secure the endorsement of labor unions while announcing her opposition to the Keystone XL oil pipeline, a project they supported but environmentalists opposed, according to leaked emails published by Wikileaks on Friday.
Before announcing in September 2015 that she opposed TransCanada Corp's proposal to build a pipeline from Canada to the United States, her campaign sought to "soften the blow" to labor unions by offering an energy infrastructure plan that would create jobs, according to the emails.
The internal campaign emails from August 2015 reveal the difficulty Clinton had in appeasing both unions and environmentalists as she fought for her party's nomination ahead of the Nov. 8 election.
Wikileaks published the Clinton emails just hours after the U.S. government accused Russia of a campaign of cyber attacks against Democratic Party organizations.
In the emails, Clinton advisers discussed how to frame the candidate's "energy infrastructure" plan, which would call for replacing old pipelines, repairing rail tracks and improving the electric grid in a way that would appeal to labor unions, who had yet to endorse her at that stage.
"Could we mention that ... as we transition HRC wants to create more careers within the new energy economy? Careers is their buzz word," wrote Nikki Budzinski, labor outreach director for Hillary for America.
Clinton had long avoided taking a firm position on Keystone, which had been pending for seven years, as she sought her party's nomination last year. As secretary of state, Clinton said in 2010 she was inclined to approve it.
Rival Senator Bernie Sanders had been a staunch opponent of the pipeline. President Barack Obama did not reject the pipeline until November 2015.
Labor unions have pushed for approval of the pipeline, saying it would create thousands of construction jobs while environmentalists opposed it because it would increase greenhouse gas emissions from Canada's oil sands.
The emails show that North America's Building Trades, representing builders and construction workers, contacted the campaign after hearing that Obama would announce his denial of the pipeline in late August and that Clinton would say she "encouraged" him to make the decision.
"We are so close to getting bldg (sic) trades and if we do this right, it will be ok even though they won't like it," wrote Amanda Renteria, the campaign's national political adviser.
The Building Trades union endorsed Clinton in November and the Laborers' International Union of North America endorsed Clinton in December.