PUERTO CABELLO, Venezuela -- When hunger drew tens of thousands of Venezuelans to the streets in protest last summer, President Nicolas Maduro turned to the military to manage the country's diminished food supply, putting generals in charge of everything from butter to rice.

But instead of fighting hunger, the military is making money from it, an Associated Press investigation shows. That's what grocer Jose Campos found when he ran out of pantry staples this year. In the middle of the night, he would travel to an illegal market run by the military to buy pallets of corn flour -- at 100 times the government-set price.

"The military would be watching over whole bags of money," Campos said. "They always had what I needed."

With much of the country on the verge of starvation and billions of dollars at stake, food trafficking has become one of the biggest businesses in Venezuela, the AP found. And from generals to foot soldiers, the military is at the heart of the graft, according to documents and interviews with more than 60 officials, business owners and workers, including five former generals.

As a result, food is not reaching those who most need it.

The U.S. government has taken notice. Prosecutors have opened investigations against senior Venezuelan officials, including members of the military, for laundering riches from food contracts through the U.S. financial system, according to four people with direct knowledge of the probes. No charges have been brought.

"Lately, food is a better business than drugs," said retired Gen. Cliver Alcala, who helped oversee Venezuela's border security. "The military is in charge of food management now, and they're not going to just take that on without getting their cut."

"WHAT'S THE PROBLEM?"

After opposition attempts to overthrow him, the late President Hugo Chavez began handing the military control over the food industry, creating a Food Ministry in 2004. His socialist-run government nationalized farms and food processing plants, then neglected them, and domestic production dried up. Oil-exporting Venezuela became dependent on food imports, but when the price of oil collapsed in 2014, the government no longer could afford all the country needed.

Food rationing grew so severe that Venezuelans spent all day waiting in lines. Pediatric wards filled up with underweight children, and formerly middle class adults began picking through trash bins for scraps. When people responded with violent street protests, Maduro handed the generals control over the rest of food distribution, and the country's ports.

The government now imports nearly all of Venezuela's food, according to Werner Gutierrez, the former dean of the agronomy school at the University of Zulia, and corruption is rampant, jacking up prices and leading to shortages.

"If Venezuela paid market prices, we'd be able to double our imports and easily satisfy the country's food needs," Gutierrez said. "Instead, people are starving."

One South American businessman said he paid millions in kickbacks to Venezuelan officials as the hunger crisis worsened, including $8 million to people who work for the current food minister, Gen. Rodolfo Marco Torres. The businessman insisted on speaking anonymously because he did not want to acknowledge participating in corruption.

Last July, he struggled to get Marco Torres's attention as a ship full of yellow corn waited to dock.

"This boat has been waiting for 20 days," he wrote in text messages seen by AP.

"What's the problem?" responded Marco Torres.

Although money was not mentioned, the businessman understood that he needed to give more in kickbacks. In the end, he told the general, the boat had to pull out because costs caused by the delay were mounting.

Bank documents from the businessman's country show that he was a big supplier, receiving at least $131 million in contracts from Venezuelan food ministers between 2012 and 2015. He explained that vendors like him can afford to pay off military officials because they build huge profit margins into what they bill the state.

For example, his $52 million contract for the yellow corn was drawn up to be charged at more than double the market rate at the time, suggesting a potential overpayment of more than $20 million for that deal alone.

The Food Ministry's annual report shows significant overpayments across the board, compared to market prices. And the prices the government pays for imported foods have been increasing in recent years, while global food prices remain stable.

This spring, the opposition-controlled congress voted to censure Marco Torres for graft. Maduro vetoed it as an attempt to hurt the Food Ministry, and Marco Torres stayed on as minister.

Internal budgets from the ministry obtained by AP show the overpayment continues. For example, the government budgeted for $118 million of yellow corn in July at $357 a ton, which would amount to an overpayment of more than $50 million relative to prices that month.

"What's amazing about this is it's like a clean form of corruption," said Carabobo state lawmaker Neidy Rosal, who has denounced food-related government theft worth hundreds of millions of dollars. "It's like drug trafficking you can carry out in broad daylight."

Marco Torres did not respond to several requests for comment by phone, email and hand-delivered letter. In the past, he has said that he will not be trapped in fights with a bourgeoisie opposition.

"SCRAPING THE POT"

By putting the military in charge of food, Maduro is trying to prevent soldiers from going hungry and being tempted to participate in an uprising against an increasingly unpopular government, said retired Gen. Antonio Rivero. Venezuela's military has a long history of coups against governments, and Maduro has arrested several officials for allegedly conspiring against him from within.

"They gave absolute control to the military," Rivero said from exile in Miami. "That drained the feeling of rebellion from the armed forces, and allowed them to feed their families."

However, it also opened the door to widespread graft and further squeezed the food supply. In large part due to concerns of corruption following the government's takeover of the food industry, the three largest global food traders -- U.S.-based Archer Daniels Midland Co., Bunge Ltd. and Cargill -- have stopped selling to the Venezuelan government.

One major scam involves the strict currency controls that have been a hallmark of the administration. The government gives out a limited amount of coveted U.S. currency at a rate of 10 bolivars to the dollar. Almost everyone else has to buy dollars on the ever more expensive black market, currently at 3,000 bolivars to the dollar.

The holders of licenses to import food are among the select few who get to buy dollars at the vastly cheaper rate. Alcala, the retired general, said some officials distribute these much-desired licenses to friends. The friends then use only a fraction of the dollars to import food, and share the rest with the officials.

"We call it 'scraping the pot,' and it's the biggest scam going in Venezuela," Alcala said.

In 2014, one general presented Maduro with a list of 300 companies suspected of simply pocketing the cheap dollars they obtained with their licenses and not importing anything. No action was ever taken and the general was forced into exile, accused of corruption himself.

Some contracts go to companies that have no experience dealing in food or seem to exist only on paper. Financial documents obtained by AP show that Marco Torres gave Panama-registered company Atlas Systems International a $4.6 million contract to import pasta. Atlas has all the hallmarks of a shell company, including no known assets and the use of secretive shares to hide the identity of the company's true owners. Another government food supplier, J.A. Comercio de Generos Alimenticios, lists on its website a non-existent address on a narrow, partially paved street in an industrial city near Sao Paulo, Brazil.

The two companies transferred more than $5.5 million in U.S. dollars in 2012 and 2013 to a Geneva account controlled by two young Venezuelans, according to bank and internal company documents seen by AP. The Venezuelans were Jesus Marquina Parra and Nestor Marquina Parra, brothers-in-law of the then-food minister, Gen. Carlos Osorio. Efforts to reach the brothers were unsuccessful.

Osorio is no longer food minister, but has an even more important role in overseeing food. He was promoted in September to inspector general of the armed forces, with the mission of ensuring transparency in the military's management of the nation's food supply.

Arturo Sanchez, a former supply chain manager at a multinational dairy company, recounted unpleasant encounters with Osorio. In one case, officers forced the company to buy fructose it didn't need because they wanted to unload merchandise he suspected was ill-gotten. Another time, he said, national guardsmen took four trucks of goods without paying. Sanchez fled to Florida in 2014.

"I spent a year living in the U.S. not being able to sleep remembering all the risky situations I lived through," he said.

Osorio did not respond to requests for comment. But in the past he threatened to sue opposition lawmakers for staining his honour with false accusations of corruption. He blamed an economic war for the food shortages.

The Defence Ministry and presidential press office refused to answer repeated calls, emails and hand-delivered letters requesting comment. In the past, officials have accused the opposition of exaggerating the problem of corruption for political gain. They have said that the military's hierarchical structure makes it ideally suited to combat the real culprits: Right-wing businessmen trying to bring down the economy.

From time to time, the government carries out raids of warehouses holding smuggled goods and arrests lower-ranking military officers accused of graft. For example, the night market in Carabobo state where Campos bought his corn flour was eventually shut down and 57 tons of smuggled food seized. Now Campos buys staples from intermediaries he suspects are working with the same military officials.

In January, the government quietly arrested 40 state employees for stealing large quantities of food from open-air markets. One of those still in jail is a colonel who had been named by Osorio to serve as president of a state agency that imported food.

"We have the moral fortitude and the discipline to take on this task of protecting what belongs to the people," the defence minister, Gen. Vladimir Padrino Lopez, said in September. "The state has an obligation to root out corruption in all levels of public administration."

"IT'S THE CUSTOMER WHO PAYS"

And yet the corruption persists from the port to the markets, according to dozens of people working in Puerto Cabello, the town that handles the majority of Venezuela's food imports.

Sometimes the officials who control access to the docks keep ships waiting until they are paid off, said a stevedore at the port, who spoke anonymously because he feared losing his job.

The stevedore said clients give him envelopes of dollars to pass on to officials. He described visiting the sergeant in charge and making small talk while placing an envelope in the wastebasket. Then he slides the basket under the table and leaves. That night, his client's ships are allowed in, he said.

After ships unload their cargo, customs officials take their share, according to four customs workers. They said that without a payment equivalent to a month's minimum wage, officials will not start the process of nationalizing goods.

Bribes are also required for any missing paperwork, and can exceed $10,000 for a single shipping container, customs worker Aldemar Diaz said.

"Sometimes you actually want to do it legally, but the officials will say, 'Don't bother,"' he said.

Luis Pena, operations director at the Caracas-based import business Premier Foods, said he pays off a long roster of military officials for each shipment of food he brings in from small-scale companies in the U.S.

"You have to pay for them to even look at your cargo now," he said. "It's an unbroken chain of bribery from when your ship comes in until the food is driven out in trucks."

Worst of all, he added, is that he is forced to pay to skip a health inspection. Officials make him buy a health certificate and don't even open the containers to test a sample, he said.

A version of this process also takes place on the border, said Alcala, the retired general who was once in charge of border control. He said officers allowed smugglers to pay bribes to bring in food without proper health and safety checks. This year, Venezuelans began posting photos and videos showing magnets pulling tiny iron shavings out of freshly opened bags of sugar smuggled in from Brazil.

Pena said his contacts at the port have offered to illegally sell him government-imported staples like sugar and rice, complete with falsified papers and a military escort.

"The military was supposed to step in and make sure the food got to the people, but it's been the exact opposite," said Pena, sitting in his warehouse. "They've made it into a business, and there's no one to appeal to. In the end, it's the customer who pays."

If he tries to get through the process without bribes, he said, the food sits and spoils.

Rotting food is a problem even as 90 per cent of Venezuelans say they can't afford enough to eat. In some cases, partners buy food that is about to expire at a steep discount, then bill the government for the full price. The government has sometimes acknowledged that food it imported arrived already expired.

The problem of rotting food got so bad at Puerto Cabello that it drew rebuke in the most recent state comptroller's report, which expressed particular dismay that thousands of tons of state-imported beans had been allowed to spoil.

When the food is no longer usable, the military tries to get rid of it quietly. Puerto Cabello crane operator Daniel Arteaga watched one night last winter as workers at a state-run warehouse buried hundreds of containers of spoiled chicken and meat imported by the government.

"All these refrigerated containers, and meanwhile people are waiting in food lines each week just to buy a single chicken," he said.

Photos taken at the Puerto Cabello dump last year show men in green military fatigues helping bury beef and chicken. Residents at a slum down the hill said after the military visits the dump, they dig up animal feed, potatoes, even ham to give their children.

The docks are hidden behind high concrete walls, and guards watch every entrance. AP gained rare access in November. The low-ranking military members assigned to guard the port can be seen collaborating with thieves to steal what little food comes in, according to eight people who work behind the walls.

"You see people making off with whole sacks of flour or corn on their shoulders, and paying the guards on their way out," logistics co-ordinator Nicole Mendoza said. "You see the money changing hands, and you just lower your eyes and don't say anything."

Lt. Miletsy Rodriguez, who is in charge of a group of national guardsmen running security at the port, said people are just looking to scapegoat the military. If her unit wasn't around, looting would be even more widespread, she said.

"The majority of us are doing our best. And sooner or later we'll catch people who are not doing the job right," she said.

BRIBES ON THE ROAD

Just as bribes are needed to get food into the port, they are also required to move food out, truckers said.

The roads near the port are lined with trucks waiting to be let in. Drivers sling hammocks in their wheel wells and sometimes wait several days in the thick tropical heat. Trucking bosses recently banded together to stop paying bribes to port officials, and the officials are now punishing them by delaying the movement of cargo onto vehicles, said Jose Petit, president of the Puerto Cabello trucking association.

When the food is finally loaded onto the trucks, soldiers come by to take a cut. Photos and videos taken by truckers show officials taking sacks of sugar and coffee. As the trucks rattle off down the highway, hungry women in clothes that no longer fit chase after them to pick up anything that falls out.

Billboards lining the highway feature a drawing of an enormous ant beside a nonworking phone number to denounce corruption, and the warning, "No to bachaqueros." That's what Venezuelans call people who make a living illegally reselling food, after the leafcutter ants that haul many times their weight through the jungles.

On the roads, truck drivers face an obstacle course of military checkpoints, ostensibly set up to stop bachaqueros. Truckers say soldiers at about half the checkpoints demand bribes. Some invent infractions such as an insufficiently filled tire, and take cash along with sacks of pantry items, produce and even live chickens, the drivers said.

"It used to be you'd go your whole route and not have to pay any anything. Now at every checkpoint, they ask for 10,000 bolivars," said trucker Henderson Rodriguez, who was waiting for a third day to get into the port to pick up a load of sugar.

The surest way to move food through the network of checkpoints is to transport it under military guard. For a percentage of the product's value, military officers on the take will assign a moonlighting soldier to ride along in the truck, according to five store and restaurant owners.

Sugar and flour are among the items most in demand because they have become virtually impossible to find legally, and some businesses, like bakeries, cannot function without them. A half dozen bakery owners across the country said in interviews that military officials regularly approach them with offers to sell supplies in exchange for a bribe.

In the city of Valencia, bakery owner Jose Ferreira cuts two checks for each purchase of sugar: one for the official price of 2 cents a pound and one for the kickback of 60 cents of pound. He keeps copies of both checks in his books, seen by AP, in case the authorities ever come asking.

"You make the legal payment, and then you pay the kickback," he said. "We have no other option; there's no substitute for sugar."

The theft extends to the very end of the food supply chain, vendors said. At one market in Valencia, the military members who were appointed in August to stop contraband confiscated vendors' produce. They said the vendors did not have the right permits. The food was piled in an olive green cargo truck.

In Puerto Cabello, hungry residents said it feels like corrupt soldiers are taking food off their children's plates. Pedro Contreras, 74, watched more than 100 trucks carrying corn rattle onto the highway, and walked stiffly into traffic to sweep up the kernels that had sifted out. He planned to pound them into corn flour that night to feed his family.

"The military is getting fat while my grandchildren get skinny," he said. "All of Venezuela's food comes through here, but so little of it goes to us."

Associated Press writers Stan Lehman in Sao Paulo, Brazil, and Gisela Salomon in Miami contributed to this report.