(Bloomberg) -- Ukraine said a move by Poland to ban imports of its grains and certain other food products violated an agreement reached earlier this month, hours after Warsaw announced an effort to shield its farmers from competition. 

Poland “will keep on supporting Ukraine,” the country’s ruling party leader Jaroslaw Kaczynski said on Saturday at a rally in Lyse. “However, we have a duty to protect our citizens, farmers and avoid a crisis of our agriculture.”

The spat threaten to fray an alliance that turned the government in Warsaw into one of Ukraine’s staunchest supporters since Russia invaded the country a year ago, supplying weapons, humanitarian aid and accepting more than a million of refugees.

Earlier this month, Poland’s agriculture minister resigned following a widespread farmers’ protest over grain imports from neighboring Ukraine. Farmers are an important constituency for the ruling Law and Justice party, which is facing a tight election in the fall. 

Poland and other neighboring states had agreed to help get grain out of Ukraine and on to global markets after the Russian invasion blocked exports last year. Part of that supply is now piling up in eastern Europe, and it’s threatening local livelihoods. 

The Polish government will purchase grains from local farmers and provide additional subsidies for producers, while maintaining benefits for buying fertilizer, Kaczynski said.

Ukraine’s Agriculture Ministry said the Polish move violates an agreement reached last week in response to the recent protests. The accord stipulates that wheat, corn, sunflower seed and rapeseed from Ukraine can be shipped to Poland as long as it is then sent on to other countries by July. 

“We understand that Polish farmers are facing a difficult situation, but we are emphasizing, that now the most difficult situation is for Ukraine’s farmers,” the ministry said in a statement on its website. It proposed to reach a new accord   with Poland in the coming days.  

(Updates with comment from Ukraine in last two paragraphs.)

©2023 Bloomberg L.P.