A big oil company that stood to lose billions of dollars in an environmental lawsuit funneled generous donations to the Clinton Foundation and a political pet project of Hillary Clinton's while it lobbied the State Department to intervene in the case on its behalf.

Chevron Corporation had been embroiled in a legal battle over allegations that it polluted a stretch of Ecuador's rainforest with toxic waste after it acquired New York-based Texaco, whose oil wells had contributed to the pollution, in 2001.

Chevron claimed that an Ecuadorian court order that it pay villagers $18 billion — a sum later reduced to $9.5 billion — was the result of a corrupt scheme in which environmental groups were complicit.

Chevron's ties to Clinton raise questions about whether its generous spending gained it favor with the State Department and the woman who ran it during a critical point in the case.

Chevron has given between $500,000 and $1 million to the Clinton Foundation, donor records show. Chevron executives have participated in events for the Clinton Global Initiative, sharing the stage with Clinton insiders such as George Stephanopoulos.

The company also donated thousands of dollars to Hillary Clinton's 2008 presidential campaign.

As the legal battle over who should take responsibility for the contaminated rainforest heated up in 2009, Chevron answered Clinton's fundraising pleas for the construction of a pavilion at the 2010 World's Fair in Shanghai.

Federal law prohibited the State Department from using taxpayer money to pay for the pavilion, so Clinton's staff solicited contributions from the private sector.

On her first official trip overseas, in February 2009, Clinton was put under pressure to raise $60 million for a U.S. presence at the expo by Chinese officials who "gave Hillary an earful" about the lack of a plan to attend the event, Jonathan Allen and Amie Parnes wrote in their book HRC: State Secrets and the Rebirth of Hillary Clinton.

Clinton herself was not allowed to make one-on-one requests for cash, but she began the fundraising blitz with a conference call to 10 top executives, including Chevron's, the New York Times reported in 2010.

Chevron was among a handful of companies that quickly kicked in $5 million. Pepsi and General Electric similarly became "global sponsors."

All three firms had also donated to the Clinton Foundation.

Later donors to the pavilion project — Proctor and Gamble, Yum! Brands, Honeywell, Intel, Pfizer, Qualcomm and Boeing — were each major Clinton Foundation donors.

The foundation did not return a request for comment.

The same year Chevron agreed to co-sponsor the expo exhibit on behalf of the State Department, it was also pouring money into lobbying the agency.

Chevron's lobbying expenses spiked in 2009, when it spent more than $20.8 million on issues that included a pivotal trade deal in South America that would have affected its leverage in the Ecuador case, according to OpenSecrets.org.

The State Department was among the largest recipients of Chevron's lobbying efforts that year. Agency officials did not return a request for comment.

Clinton had appointed David Goldwyn, a man with long-standing ties to Chevron, to direct much of her energy policy.

Goldwyn, Clinton's special envoy for international energy affairs, served as the director of the U.S.-Libya Business Association, which draws a significant share of its funding from Chevron, between 2005 and 2009.

In 2005, Goldwyn and a Chevron executive, Jan Kalicki, together penned a book about foreign energy policy.

Clinton herself had a deep connection to the oil conglomerate before becoming secretary of state.

The Clintons had " significant investments" in Chevron before they shifted all their assets from stocks to cash ahead of Hillary's first presidential campaign to avoid conflicts of interest, the Washington Post reported in 2007.

Chevron's interactions with the State Department during Clinton's tenure were certainly not limited to the issue of Texaco's operations in Ecuador, however.

As Clinton's State Department touted the virtue of fracking around the globe, Chevron racked up drilling rights on six continents with the agency's help.

"By 2012, Chevron had large shale concessions in Argentina, Australia, Canada, China, and South Africa, as well as in Eastern Europe, which was in the midst of a claim-staking spree; Poland alone had granted more than 100 shale concessions covering nearly a third of its territory," Mother Jones reported last year.

Goldwyn, who left the State Department in 2011 for Goldwyn Global Strategies, put together a series of fracking workshops for government officials in Bulgaria, Lithuania, Poland, Romania and Ukraine on Chevron's dime in 2012, and all but Bulgaria "would later grant Chevron major shale concessions," the report said.

Chevron executives were busy in Ecuador at that time attempting to draw the State Department into their fight against the 30,000 locals who had secured a ruling against Chevron in 2011.

They had been doing so for many years. A leaked diplomatic cable sent in March 2006 showed representatives from Chevron met regularly with embassy officials in Ecuador to keep them abreast of the legal slog.

State Department officials "were surprised" that the Chevron representative who met with the U.S. ambassador March 17 of that year "requested no [U.S. government] intervention in the case," which was "in contrast to other Chevron reps we have met in the past," the 2006 document said.

"In previous meetings, Chevron reps have suggested that the [U.S. government] pressure the [government of Ecuador] to assume responsibility for the environmental damage in the areas once operated by Chevron," the cable continued.

Chevron released secretly-recorded tapes it claimed as evidence of corruption in the Ecuadorian legal system in August 2009, another diplomatic cable shows.

"Plaintiffs in the case, the Front for the Defense of the Amazon, accuse Chevron of shamefully, and perhaps illegally, manufacturing the tapes to disrupt the landmark environmental case against it," the September 2009 cable said.

Subsequent documents suggest Chevron lobbied the State Department to alter a draft of its annual Human Rights Report on Ecuador in late 2009. That report, which included an assessment of the country's judicial system, was later cited as proof of the court's corruption as Chevron attempted to discredit the judgement against them.

Emails obtained through the Freedom of Information Act show a lobbyist for Chevron met with the officials responsible for drafting the report before agency officials circulated an email titled "Chevron meeting — how the 2009 HRR looks now."

The contents of the email were redacted.

However, the 2009 Human Rights Report contained a passage referring to Chevron's case that was not included in the 2008 report.

"In August a multinational oil company provided government authorities with clandestinely recorded videos that it alleged exposed a bribery scheme related to a multi-billion dollar environmental lawsuit pending against it in an Ecuadorian court," the report said. "The Prosecutor General's Office opened an investigation into the allegations, while plaintiffs in the lawsuit claimed the videos were fabricated."

Theodore Folkman, the international business attorney at Murphy & King who filed the FOIA requests for the State Department's Chevron documents, said the high-level lobbying effort to alter the report created a transparency issue.

"If you're going to cite these reports as evidence of what the truth is, it's important to know how they get written," Folkman said.

After the court in Ecuador handed down its punishing judgement against Chevron in 2011, the company continued its efforts to engage the State Department on its behalf.

This included a personal appeal from Chevron's CEO to Clinton when they discussed the case at a dinner in 2012.

John Watson, the CEO of the company, "had a very good dinner discussion with the Secretary" in April 2012, emails between Chevron executives and State Department officials show.

The talks took place at a lavish dinner honoring the prime minister of Japan at the National Geographic Museum in Washington.

Watson "took the opportunity to express our concerns about developments in the Chevron Ecuador litigation" to Clinton at the banquet, another Chevron executive wrote in an email to State Department officials.

"We believe it is important and urgent that the [U.S. government] communicate to the [Government of Ecuador] that any actions they take to support this fraudulently-obtained judgement could jeopordize their trade preferences," Chevron wrote in the email.

Chevron scored a major victory in the case last year when a Clinton-appointed judge in New York blocked the enforcement of the multi-billion dollar ruling against the oil company in the U.S.

The 2009 Human Rights Report buttressed Judge Lewis Kaplan's thorough findings of fraud and corruption among the plaintiffs' legal team, Folkman noted.

"The oil company's sole witness to its central charge of bribery was a corrupt Ecuadorean ex-judge named Alberto Guerra, whose entire family has been naturalized and relocated on Chevron's dime," Rolling Stone reported in August. "The entire case turned on the testimony of a witness living under a corporate protection plan."

UPDATE: A Chevron spokesperson responded Monday with the following statement: "Chevron is committed to creating prosperity in communities by investing in health, education and economic development in the areas where we do business. The Clinton Global Initiative was one of the many partnerships and programs that the company has had or maintains to advance that objective. Over the past 9 years Chevron has contributed approximately $1.7 billion in social investments to local communities, and in 2014 alone we spent approximately $240 in global social investments."

The spokesperson encouraged the Washington Examiner to read several articles that describe the alleged fraud of plaintiffs in the Ecuador case that helped locals secure a ruling against Chevron, including a Wall Street Journal editorial that called the lawsuit "the legal fraud of the century."

"The claims against Chevron in Ecuador are meritless and fraudulent. A U.S. federal court has found that the lawyers behind the case committed racketeering, extortion, money laundering, wire fraud, Foreign Corrupt Practices Act violations, witness tampering and obstruction of justice in obtaining the Ecuadorian judgment against Chevron. Additionally, seventeen former insiders testified at trial that the lawyers behind the case fabricated environmental evidence, pressured scientific experts to falsify reports, plotted to intimidate judges into handing down favorable rulings, bribed court-appointed experts, ghostwrote court reports and even drafted the final judgment," the spokesperson said of the case.