The European Union said Friday it was ending an import ban on Ukrainian grain in five member states, but Poland, Hungary and Slovakia immediately announced they would defy the move.
The European Commission announced "existing measures will expire today" when they run out at midnight.
"The market distortions in the five Member States bordering Ukraine have disappeared," the EU's executive arm said.
The decision had been taken after Kyiv agreed to introduce measures such as an export licensing system within 30 days to "avoid grain surges", the commission said.
In the meantime, Ukraine would put in place measures to control the export of wheat, maize, rapeseed and sunflower seed to avoid upsetting markets in its EU neighbours, it added.
Ukraine's President Volodymyr Zelensky hailed the move from Brussels as "an example of true unity and trust" between Kyiv and the EU.
"We need our neighbours to support Ukraine in times of war. And if their decisions violate EU law, Ukraine will respond in a civilized manner," he wrote on social media.
- Dissenting countries -
EU trade commissioner Valdis Dombrovskis urged member states to "refrain from unilateral measures and work along the lines of this agreement".
But despite the reassurances, Poland, Hungary and then Slovakia promptly announced they would extend the bans in their countries.
"We do not agree with the European Commission’s decision and in the interest of Polish farmers and consumers, we are introducing national measures," Polish government spokesman Piotr Muller told state news agency PAP.
The issue is particularly sensitive in Poland, where elections take place next month.
The current populist right-wing government of the Law and Justice party has strong support in farming regions.
The issue of grain imports has triggered a diplomatic spat between Poland and Ukraine, with Kyiv threatening possible legal action.
Poland is a major supplier of military and humanitarian aid to Ukraine and hosts some one million Ukrainian refugees.
Hungary said it was going to close its border to 24 Ukrainian products, up from four previously.
Its ban includes cereals, rapeseed and sunflower seeds, flour, cooking oil, honey, certain meats and eggs.
And Slovakia's said government it would be banning the import of four commodities, including wheat, until the end of the year.
Romania, meanwhile, expressed regret that Brussels had failed to find a European solution for extending import restrictions on Ukrainian cereals.
A government statement said it was waiting to hear from Ukraine "regarding efficient control measures" before deciding "the right measures to protect Romanian farmers".
- Global concerns -
Russia's invasion of Ukraine has closed off Black Sea shipping lanes used before the war, resulting in the EU becoming a major transit route and export destination for Ukrainian grain.
In May, the EU agreed to restrict imports to Bulgaria, Hungary, Poland, Romania and Slovakia, seeking to protect farmers there who blamed the imports for a slump in prices on local markets.
The measures allowed the products to keep transiting through the five countries, but stopped them being sold on the local market.
Among the other countries, Romania has promised it will follow the EU's lead, while Bulgaria pledged to drop the restrictions.
Bulgaria stands out from its regional neighbours because it has many sunflower oil producers who have complained of a serious shortage of seeds and high prices since the embargo was put in place.
Russia's stifling of grain exports from agricultural powerhouse Ukraine has spurred global concerns over grain supplies.
Moscow pulled the plug on a United Nations deal to allow exports via the Black Sea in July and has since upped attacks on Ukrainian export facilities.
The EU has bolstered other routes over land and along rivers that have been used to export over 44 million tonnes of grain from Ukraine since the invasion.