Newly released emails from Hillary Clinton's tenure as secretary of state detail how the State Department assisted Walmart's efforts in 2011 to buy a South African retail chain called Massmart despite the opposition of local unions.

The emails show that U.S. diplomats talked up Walmart to skeptical South African government officials, even playing some hardball on the company's behalf.

Other emails show that Clinton retained close ties to the Arkansas-based retailer, where she was a board member from 1986 through 1992. Clinton has more recently sought to distance herself from the company, which many liberal groups despise for its anti-union stance.

Then-Walmart President Mike Duke personally emailed Clinton in September 2011 to thank her for "taking the time to meet with our executives at the [Asian-Pacific Economic Cooperation] summit and your kind words about our initiative. I am grateful for your support and partnership," Duke said.

Earlier that year, State Department officials had taken a keen interest in Walmart's attempt to gain a major foothold in the South African retail market by buying 51 percent of the Massmart chain. Shareholders had approved the buyout, but the Congress of South African Trade Unions, the main labor federation there, was fighting the deal, which required approval by the nation's Competition Tribunal.

In a statement to the Washington Examiner, the company defended the connection by saying it's a routine job for the U.S. government to fight for U.S. business interests.

"The mission of government agencies like United States Trade Representative and the State Department is to help promote business interests overseas and advocate for U.S. businesses investing in foreign countries," the company said.

"Our disclosures show that our business interest in South Africa was discussed with U.S. government officials at the USTR, Commerce and the State Department, along with more than a dozen other topics important to our business," it said.

It is not unusual for the State Department to help U.S. companies abroad. It has an entire section, the Office of Commercial and Business Affairs, to serve as the "gateway for American businesses overseas."

A March 24 message from the American consulate in Johannesburg to Washington related how the labor federation "frets that Walmarts (sic) entry into the South African Market will cost South Africa jobs by forcing the closure of other retailers that will be unable to compete."

It concludes by stating that Walmart "faces a politicized climate and powerful labor union."

A follow-up message from the embassy on May 6 said that Deputy Secretary of State Tom Nides had raised the issue in a meeting with South African Minister of Economic Development Ebrahim Patel.

Nides "said that Walmart's reputation as portrayed in the media does not reflect its current position and the way it intends to do business in South Africa," the message said.

The May 6 message added that the Nides and U.S. Ambassador Donald Gips "expressed the belief [to Patel] that Walmart will be a net job creator and a positive economic force in South Africa."

The two also warned that the Arkansas-based company "is concerned that the requested commitments regarding jobs and local sourcing would tie its hands in a very competitive sector" and that "refusal to accept Walmart could discourage other foreign investment."

Several sections of the message are redacted, including what are apparently some of Patel's comments in response.

A May 31 message from the embassy announced that the government had consented to the acquisition. There were several conditions to it, including requirements that Walmart not have any layoffs for the first two years and that it create a $14.6 million fund for "developing local suppliers."

The message nevertheless indicated that the final deal was on Walmart's terms. "These requirements are basically a reformulation of voluntary offers made by Walmart and Massmart before the decision was announced. No local procurement requirements were imposed," the May 31 email stated.

Also released Friday with the emails was an apparent set of talking points for Clinton for a trip to South Africa that was planned for June 2011 but never happened. State Department records indicate that she held no press conference in South Africa that month. The talking points call for her to say that the Walmart-Massmart deal is "good news for South Africa."