Ukrainian food conglomerate MHP SE built its business exporting grains and poultry to Europe, the Middle East and North Africa. War forced a pivot, and now the company supplies the Ukrainian army and delivers ready-to-eat chicken to civilians in bombed-out cities.

The shift shows how quickly Ukraine’s farming industry—a global heavyweight—flipped from feeding the world to feeding the nation. Russia’s invasion is displacing millions of people and stranding more without access to electricity, water and other essentials.

Even with the country’s damaged infrastructure and the challenges getting fuel and chicken feed, its agriculture sector is making efforts to keep food supplies afloat. MHP is boosting production at its poultry plants in the Vinnytsia, Cherkasy and Dnipro regions, trying to fill the gap created when competitors failed and pork companies in the devastated eastern region shut down, MHP executive chairman John Rich said in an interview from Slovenia.

“We’ve been delivering the humanitarian aid to outside of cities so people can get access to it,” Rich said. “Ready-to-eat products are being distributed to areas where they can’t cook. You’ve got to feed children.”

The war is shocking commodities markets and spurring food prices higher as exports from the Black Sea region are disrupted. Ukraine is the world’s second-largest grains shipper and a major chicken seller. MHP produces as much as 900,000 tons of chicken a year, and about 750,000 tons of that comes from Ukraine. The Russian navy’s blockade of Ukraine’s ports is pushing up chicken prices in Brazil.

Some Ukrainian agricultural companies are struggling to continue operations. Grain exporter and oilseed processor Kernel Holding SA invoked force majeure Tuesday, saying it can’t move goods abroad because of safety and security concerns.

Ukrlandfarming said last week that 3 million chickens in its plant in the southern city of Kherson faced dying from hunger because shelling by Russia’s military was destroying its system for bringing them feed. Combined with similar problems at other plants, that risks cutting national egg production by a sixth, the company said.

Grain, sugar and milk producer Astarta Holding NV, among the nation’s five biggest agricultural landholders, has delivered more than 500 tons of food to soldiers and civilians, and said it was actively preparing for spring planting. The company is providing shelter to thousands of refugees at its facilities and dormitories.

MHP is supplying food to the army at cost and meat to cities for free, and it’s trying to cover expenses with supermarket sales. It also pledged last month to make free deliveries to hospitals. The company, which employs more than 26,000 people in Ukraine, is losing money, Rich said.

The producer farms about 1 million acres of grain, including wheat, corn and rapeseed, in Ukraine and makes sunflower oil. It still has stocks of fuel, fertilizer and pesticides, and could start sowing within two weeks if the current situation doesn’t change, Rich said.

“As we speak, we have about 50,000 hectares in the red zones, which means we have Russian artillery and tanks sitting on it so this is, at present, nonoperational,” Rich said. “If we get the opportunity we’ll sow. If the war develops and gets worse, then we don’t know.”