Former Russian president Dmitry Medvedev said on Sunday that if the G7 moved to ban exports to Russia, Moscow would respond by terminating the Black Sea Grain deal that enables vital exports of grain from Ukraine.

The Group of Seven (G7) countries are considering a near-total ban on exports to Russia, Japan's Kyodo news agency reported last week, citing Japanese government sources. Russia has repeatedly threatened to scrap its participation in the grain deal, which is due to expire on May 18.

"This idea from the idiots at the G7 about a total ban of exports to our country by default is beautiful in that it implies a reciprocal ban on imports from our country, including categories of goods that are the most sensitive for the G7," Medvedev said in a post on his Telegram channel.

"In such a case, the grain deal - and many other things that they need - will end for them," he added.

The G7 is reportedly discussing reversing its sanctions approach so that exports to Russia are automatically banned unless they are included on a designated list of products allowed to be shipped to the country. Under the current framework, goods are allowed to be sold to Russia unless they are explicitly black-listed.

Medvedev, a long-time ally of Russian President Vladimir Putin, is Putin's deputy chair at the influential Security Council and heads a government commission on arms production for the war in Ukraine.

Moscow has repeatedly rallied against the terms of the Black Sea grain deal - the only significant diplomatic breakthrough of the 14-month conflict in Ukraine. It has said it will walk away from the initiative ahead of a May 18 deadline if the West does not lift restrictions on Russian agricultural and fertiliser exports.

The G7 called on Sunday for the "extension, full implementation and expansion" of the deal to export Ukrainian grain through the Black Sea, the group's agriculture ministers said in a communique.

(Reporting by Jake Cordell; Editing by Hugh Lawson and Susan Fenton)