Inside Walmart’s corporate offices in Brazil, one local contact was known as the “sorceress” for the ability to obtain government permits quickly.

In India, concerns about bribery were met with a “wink and a nod” by Walmart’s local business partner. In China, money was funneled to a local landlord for “government relationship consulting services.” And in Mexico, cars and computers were donated to governments in communities where Walmart was planning to build new stores.

For more than a decade, Walmart used middlemen to make dubious payments to governments around the globe in order to open new locations, United States prosecutors and securities regulators said in a settlement agreement on Thursday. But even as employees frequently raised alarm, the company’s top leaders did little to prevent Walmart from being involved in bribery and corruption schemes.

That lack of internal control led to a seven-year inquiry that culminated on Thursday with Walmart’s Brazilian subsidiary pleading guilty to a federal crime. The guilty plea, and the $282 million in fines that Walmart has agreed to pay, capped one of the biggest investigations ever under the Foreign Corrupt Practices Act, which makes it illegal for American corporations to bribe overseas officials.